mirror of
https://github.com/danog/amp.git
synced 2024-11-30 04:29:08 +01:00
Convert RuntimeException to CombinatorException
This commit is contained in:
parent
63055f0784
commit
00898cd6af
@ -1,6 +1,7 @@
|
||||
# dev
|
||||
|
||||
- n/a
|
||||
- Convert general `\RuntimeException` to more specific
|
||||
`Amp\CombinatorException`.
|
||||
|
||||
### 1.0.4
|
||||
|
||||
|
7
lib/CombinatorException.php
Normal file
7
lib/CombinatorException.php
Normal file
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Amp;
|
||||
|
||||
class CombinatorException extends \RuntimeException {
|
||||
|
||||
}
|
@ -310,7 +310,7 @@ function some(array $promises) {
|
||||
}
|
||||
if (empty($struct->results)) {
|
||||
array_unshift($struct->errors, "All promises passed to Amp\some() failed");
|
||||
$struct->promisor->fail(new \RuntimeException(
|
||||
$struct->promisor->fail(new CombinatorException(
|
||||
implode("\n\n", $struct->errors)
|
||||
));
|
||||
} else {
|
||||
@ -407,7 +407,7 @@ function first(array $promises) {
|
||||
return;
|
||||
}
|
||||
if (--$struct->remaining === 0) {
|
||||
$struct->promisor->fail(new \RuntimeException(
|
||||
$struct->promisor->fail(new CombinatorException(
|
||||
"All promises failed"
|
||||
));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user