/**
  * @param IError $error
  */
 public function handleError(IError $error)
 {
     $response = new JsonResponse(HttpStatusCode::INTERNAL_SERVER_ERROR);
     $response->getData()->set('error.message', $error->getMessage());
     $response->getData()->set('error.code', $error->getCode());
     $response->getData()->set('error.file', $error->getFile());
     $response->getData()->set('error.line', $error->getLine());
     $this->httpApp->shutdownWithResponse($response);
 }
 function it_handles_error(IHttpApp $httpApp, IError $error)
 {
     $error->getMessage()->willReturn('message');
     $error->getCode()->willReturn('code');
     $error->getFile()->willReturn('file');
     $error->getLine()->willReturn('line');
     $response = new JsonResponse(HttpStatusCode::INTERNAL_SERVER_ERROR);
     $response->getData()->set('error.message', 'message');
     $response->getData()->set('error.code', 'code');
     $response->getData()->set('error.file', 'file');
     $response->getData()->set('error.line', 'line');
     $httpApp->shutdownWithResponse($response)->shouldBeCalled();
     $this->handleError($error);
 }
 /**
  * @param IError $error
  *
  * @return bool
  */
 public function handleError(IError $error)
 {
     $this->bugsnagClient->errorHandler($error->getCode(), $error->getMessage(), $error->getFile(), $error->getLine());
 }
 /**
  * @param IError $error
  *
  * @return bool
  */
 public function handleFatalError(IError $error)
 {
     $logLevel = ErrorCodeToLogLevelMap::getLogLevelForErrorCode($error->getCode());
     $message = s('Fatal Error (%s): %s', ErrorType::getErrorTypeName($error->getCode()), $error->getMessage());
     $details = ['code' => $error->getCode(), 'message' => $error->getMessage(), 'file' => $error->getFile(), 'line' => $error->getLine()];
     $this->logger->log($logLevel, $message, $details);
 }
Ejemplo n.º 5
0
 /**
  * @param IError $error
  *
  * @return mixed
  * @throws MissingExceptionForErrorType
  */
 public static function createExceptionForError(IError $error)
 {
     $class = static::getExceptionClassForError($error->getCode());
     $ex = new $class($error->getCode(), $error->getMessage(), $error->getFile(), $error->getLine());
     return $ex;
 }