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

Fail promise timeout() operations using TimeoutException

This commit is contained in:
Daniel Lowrey 2015-07-31 15:49:05 -04:00
parent 094899a74b
commit 705c57483b
2 changed files with 6 additions and 1 deletions

5
lib/TimeoutException.php Normal file
View File

@ -0,0 +1,5 @@
<?php
namespace Amp;
class TimeoutException extends \RuntimeException {}

View File

@ -720,7 +720,7 @@ function timeout(Promise $promise, $msTimeout) {
$promisor = new Deferred;
$watcherId = once(function () use ($promisor, &$resolved) {
$resolved = true;
$promisor->fail(new \RuntimeException(
$promisor->fail(new TimeoutException(
"Promise resolution timed out"
));
}, $msTimeout);