1
0
mirror of https://github.com/danog/amp.git synced 2024-11-27 04:24:42 +01:00
amp/lib/Failure.php

29 lines
483 B
PHP
Raw Normal View History

2014-09-22 22:47:48 +02:00
<?php
2014-09-23 04:38:32 +02:00
namespace Amp;
2014-09-22 22:47:48 +02:00
/**
2015-03-19 16:14:21 +01:00
* Represents a failed computation resolution
2014-09-22 22:47:48 +02:00
*/
class Failure implements Promise {
private $error;
public function __construct(\Exception $error) {
$this->error = $error;
}
/**
2015-03-23 16:07:40 +01:00
* {@inheritDoc}
2014-09-22 22:47:48 +02:00
*/
public function when(callable $func) {
$func($this->error, $result = null, $callbackData = null);
2014-09-22 22:47:48 +02:00
}
/**
2015-03-23 16:07:40 +01:00
* {@inheritDoc}
2014-09-22 22:47:48 +02:00
*/
public function watch(callable $func) {
return;
}
}