-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexceptions.php
79 lines (63 loc) · 2.01 KB
/
exceptions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
namespace Moebius\Coroutine;
class Exception extends \Exception {}
/**
* Exception for when we detect a flaw in the program logic
* which for example can lead to an application sleeping
* forever.
*/
class LogicException extends \LogicException {}
/**
* Exception for when a function is being used incorrectly.
*/
class IncorrectUsageException extends LogicException {}
/**
* Exception when something internal to the coroutine library must be wrong.
*/
class InternalLogicException extends LogicException {}
/**
* Exception thrown when an unexpected fiber is encountered.
*/
class UnknownFiberException extends LogicException {}
/**
* Exception thrown when an invalid argument was passed.
*/
class InvalidArgumentException extends \InvalidArgumentException {}
/**
* Exception when a coroutine was expected as an argument
*/
class CoroutineExpectedException extends InvalidArgumentException {}
class NoCoroutineContextException extends LogicException {}
/**
* Generic runtime exceptions
*/
class RuntimeException extends \RuntimeException {}
/**
* Generic runtime IO error
*/
class IOException extends RuntimeException {}
/**
* Exception when a promise was expected.
*/
class PromiseExpectedException extends RuntimeException {}
/**
* Exception when a promise-like object was expected.
*/
class ThenableExpectedException extends PromiseExpectedException {}
/**
* Exception when a promise is already resolved, and an unresolved
* promise was expected.
*/
class PromiseResolvedException extends RuntimeException {}
/**
* Exception when a promise is rejected without an exception. These
* rejection reasons can't be thrown so this exception is a wrapper
* intended to throw such exceptions.
*/
class RejectedException extends RuntimeException {
public readonly mixed $reason;
public function __construct(mixed $reason) {
$this->reason = $reason;
parent::__construct("Promise rejected without an exception. The value is available via the 'reason' property of this exception.");
}
}