/** * Creates exception response * * @param \Exception $exception */ public function getExceptionResponse(\Exception $exception) { $this->add($exception); // only set status code if default - allows controllers to overwrite if ($this->response->getStatusCode() == Response::HTTP_OK) { $code = $exception instanceof HttpExceptionInterface ? $exception->getStatusCode() : Response::HTTP_BAD_REQUEST; $this->response->setStatusCode($code); } return $this->send(); }