Debian Codegraph @

vendor/react/promise/src/UnhandledRejectionException.php

raw
1 <?php
2
3 namespace React\Promise;
4
5 class UnhandledRejectionException extends \RuntimeException
6 {
7 private $reason;
8
9 public static function resolve($reason)
10 {
11 if ($reason instanceof \Exception || $reason instanceof \Throwable) {
12 return $reason;
13 }
14
15 return new static($reason);
16 }
17
18 public function __construct($reason)
19 {
20 $this->reason = $reason;
21
22 $message = \sprintf('Unhandled Rejection: %s', \json_encode($reason));
23
24 parent::__construct($message, 0);
25 }
26
27 public function getReason()
28 {
29 return $this->reason;
30 }
31 }