/** * Handles the error reported by the user or system. * Converts the error to an exception if configured. * @param integer $errorCode the error code number * @param string $errorMessage the error message * @param string $errorFile the error file name * @param integer $errorLine the error line number * @throws \Brickoo\Component\Error\Exception\ErrorOccurredException * @return boolean true to block php error message forwarding */ public function handleError($errorCode, $errorMessage, $errorFile, $errorLine) { $message = sprintf("%s in %s on line %s", $errorMessage, $errorFile, $errorLine); if ($this->convertToException) { throw new ErrorOccurredException($message, $errorCode); } $this->messageDispatcher->dispatch(new ErrorMessage($message)); return true; }
/** {@inheritDoc} */ public function handleMessage(Message $message, MessageDispatcher $messageDispatcher) { if ($message instanceof ErrorMessage) { $messageDispatcher->dispatch(new LogMessage([$message->getErrorMessage()], Logger::SEVERITY_ERROR)); } }
/** * Handles the exception thrown by the user or system. * Dispatch a log message containing the exception message. * @param \Exception $exception the exception thrown * @return \Brickoo\Component\Error\ExceptionHandler */ public function handleException(\Exception $exception) { $this->messageDispatcher->dispatch(new ExceptionMessage($exception)); return $this; }
/** {@inheritDoc} */ public function handleMessage(Message $message, MessageDispatcher $messageDispatcher) { if ($message instanceof ExceptionMessage) { $messageDispatcher->dispatch(new LogMessage($this->getExceptionMessage($message->getException()), Logger::SEVERITY_CRITICAL)); } }
/** {@inheritDoc} */ public function collect() { $message = new GenericMessage(Messages::COLLECT_ROUTES, $this); $this->messageDispatcher->dispatch($message); return $this->extractRouteCollections($message->getResponseList()); }