Beispiel #1
0
 /**
  * Handle an error by passing the exception to the registered error handler
  * @param  \Exception $e
  * @throws \Exception
  */
 private function handleError(\Exception $e)
 {
     $eh = $this->getErrorHandler();
     try {
         $representation = $this->getDeterminedRepresentation();
         $errorDocument = $representation->getDefaultErrorResponse();
         $eh->error($e, 500, $errorDocument);
     } catch (UnableToMatchRepresentationException $e) {
         $errorDocument = new ErrorResponseText();
         $eh->error($e, 500, $errorDocument);
     }
     $this->response->setStatusCode($eh->getResponseCode());
     $this->response->setHttpHeader('Content-Type', $errorDocument::getContentType());
     $this->response->setBody($errorDocument->render());
 }