# decalog/4.4.0/includes/libraries/react/Promise/UnhandledRejectionException.php

DecaLog, version 4.4.0. 32 lines.

- Page: https://pluginprobe.com/plugins/decalog/4.4.0/code/includes/libraries/react/Promise/UnhandledRejectionException.php
- Raw: https://pluginprobe.com/plugins/decalog/4.4.0/raw/includes/libraries/react/Promise/UnhandledRejectionException.php
- Modified: 2020-04-07T09:58:40+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/decalog/4.4.0/code/includes/libraries/react/Promise/UnhandledRejectionException.php#L10-L20`.

```php
<?php

namespace React\Promise;

class UnhandledRejectionException extends \RuntimeException
{
    private $reason;

    public static function resolve($reason)
    {
        if ($reason instanceof \Exception || $reason instanceof \Throwable) {
            return $reason;
        }

        return new static($reason);
    }

    public function __construct($reason)
    {
        $this->reason = $reason;

        $message = \sprintf('Unhandled Rejection: %s', \json_encode($reason));

        parent::__construct($message, 0);
    }

    public function getReason()
    {
        return $this->reason;
    }
}

```
