/** * On multi exception event. * * @param \Ivory\HttpAdapter\Event\MultiExceptionEvent $event The multi exception event. */ public function onMultiException(MultiExceptionEvent $event) { $retryRequests = array(); foreach ($event->getExceptions() as $exception) { if ($this->retry->retry($exception->getRequest(), false)) { $retryRequests[] = $exception->getRequest(); $event->removeException($exception); } } if (empty($retryRequests)) { return; } try { $event->addResponses($event->getHttpAdapter()->sendRequests($retryRequests)); } catch (MultiHttpAdapterException $e) { $event->addResponses($e->getResponses()); $event->addExceptions($e->getExceptions()); } }