| @@ 159-167 (lines=9) @@ | ||
| 156 | ||
| 157 | $request->getEmitter()->on( |
|
| 158 | 'error', |
|
| 159 | function (ErrorEvent $event) use ($error, $internalRequest, $httpAdapterName) { |
|
| 160 | $exception = HttpAdapterException::cannotFetchUri( |
|
| 161 | $event->getException()->getRequest()->getUrl(), |
|
| 162 | $httpAdapterName, |
|
| 163 | $event->getException()->getMessage() |
|
| 164 | ); |
|
| 165 | $exception->setRequest($internalRequest); |
|
| 166 | call_user_func($error, $exception); |
|
| 167 | } |
|
| 168 | ); |
|
| 169 | } |
|
| 170 | ||
| @@ 113-122 (lines=10) @@ | ||
| 110 | $response = $response->withParameter('request', $internalRequests[$index]); |
|
| 111 | call_user_func($success, $response); |
|
| 112 | }, |
|
| 113 | 'rejected' => function ($exception, $index) use ($error, $internalRequests, $httpAdapter) { |
|
| 114 | $exception = HttpAdapterException::cannotFetchUri( |
|
| 115 | $exception->getRequest()->getUri(), |
|
| 116 | $httpAdapter->getName(), |
|
| 117 | $exception->getMessage() |
|
| 118 | ); |
|
| 119 | ||
| 120 | $exception->setRequest($internalRequests[$index]); |
|
| 121 | call_user_func($error, $exception); |
|
| 122 | }, |
|
| 123 | ))); |
|
| 124 | ||
| 125 | $pool->promise()->wait(); |
|