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