@@ 61-70 (lines=10) @@ | ||
58 | { |
|
59 | $deferred = new self($this->waitCallback); |
|
60 | ||
61 | $this->onFulfilledCallbacks[] = function (ResponseInterface $response) use ($onFulfilled, $deferred) { |
|
62 | try { |
|
63 | if (null !== $onFulfilled) { |
|
64 | $response = $onFulfilled($response); |
|
65 | } |
|
66 | $deferred->resolve($response); |
|
67 | } catch (ClientExceptionInterface $exception) { |
|
68 | $deferred->reject($exception); |
|
69 | } |
|
70 | }; |
|
71 | ||
72 | $this->onRejectedCallbacks[] = function (ClientExceptionInterface $exception) use ($onRejected, $deferred) { |
|
73 | try { |
|
@@ 72-84 (lines=13) @@ | ||
69 | } |
|
70 | }; |
|
71 | ||
72 | $this->onRejectedCallbacks[] = function (ClientExceptionInterface $exception) use ($onRejected, $deferred) { |
|
73 | try { |
|
74 | if (null !== $onRejected) { |
|
75 | $response = $onRejected($exception); |
|
76 | $deferred->resolve($response); |
|
77 | ||
78 | return; |
|
79 | } |
|
80 | $deferred->reject($exception); |
|
81 | } catch (ClientExceptionInterface $newException) { |
|
82 | $deferred->reject($newException); |
|
83 | } |
|
84 | }; |
|
85 | ||
86 | return $deferred; |
|
87 | } |