| @@ 78-86 (lines=9) @@ | ||
| 75 | throw $exception; |
|
| 76 | }; |
|
| 77 | ||
| 78 | $this->onFulfilled = function (ResponseInterface $response) use ($onFulfilled, $deferred) { |
|
| 79 | try { |
|
| 80 | $deferred->resolve($onFulfilled($response)); |
|
| 81 | } catch (Exception $exception) { |
|
| 82 | $deferred->fail($exception); |
|
| 83 | } catch (\Throwable $error) { |
|
| 84 | $deferred->fail(new Exception\TransferException($error->getMessage(), 0, $error)); |
|
| 85 | } |
|
| 86 | }; |
|
| 87 | ||
| 88 | $this->onRejected = function (Exception $exception) use ($onRejected, $deferred) { |
|
| 89 | try { |
|
| @@ 88-96 (lines=9) @@ | ||
| 85 | } |
|
| 86 | }; |
|
| 87 | ||
| 88 | $this->onRejected = function (Exception $exception) use ($onRejected, $deferred) { |
|
| 89 | try { |
|
| 90 | $deferred->resolve($onRejected($exception)); |
|
| 91 | } catch (Exception $exception) { |
|
| 92 | $deferred->fail($exception); |
|
| 93 | } catch (\Throwable $error) { |
|
| 94 | $deferred->fail(new Exception\TransferException($error->getMessage(), 0, $error)); |
|
| 95 | } |
|
| 96 | }; |
|
| 97 | ||
| 98 | if (HttpPromise::FULFILLED === $this->state) { |
|
| 99 | $this->resolve($this->response); |
|