diff --git a/src/GenericApi.php b/src/GenericApi.php index 94c4ac4..9dbc955 100644 --- a/src/GenericApi.php +++ b/src/GenericApi.php @@ -162,13 +162,13 @@ public function process(ApiServiceInterface $service) $this->debugger->finishRequestProcess($debugProcess, $httpResponse); } + $this->getEventDispatcher()->dispatch(self::EVENT_ON_RESPONSE, new OnResponseEvent($this, $service, $httpResponse)); + //has pending exception if ($exception && $exception instanceof \Exception) { throw $exception; } - $this->getEventDispatcher()->dispatch(self::EVENT_ON_RESPONSE, new OnResponseEvent($this, $service, $httpResponse)); - if ($responseParser = $requestBuilder->getResponseParser()) { if ($newResponse = $responseParser->parse($httpResponse)) { return $newResponse;