1
0
mirror of https://github.com/danog/amp.git synced 2025-01-07 05:28:17 +01:00
amp/lib/Failure.php
2015-03-23 11:07:40 -04:00

29 lines
461 B
PHP

<?php
namespace Amp;
/**
* Represents a failed computation resolution
*/
class Failure implements Promise {
private $error;
public function __construct(\Exception $error) {
$this->error = $error;
}
/**
* {@inheritDoc}
*/
public function when(callable $func) {
$func($this->error, $result = null);
}
/**
* {@inheritDoc}
*/
public function watch(callable $func) {
return;
}
}