response->getStatusCode() >= 400) { $event = new FailureRequestEvent( $responseData->baseUrl, $responseData->request, $responseData->response, $this->apiExceptionFactory->createException( $this->unmarshalBody($responseData->response, ErrorResponse::class), $responseData->response->getStatusCode() ) ); $this->dispatch($event); if (!$event->shouldSuppressThrow()) { throw $event->getException(); } } return $this->next($responseData); } }