protected function handleException($e)
 {
     //if (!($e instanceof CHttpException && $e->statusCode == 404)) { // skip 404
     Monolog\Registry::main()->addError(sprintf('Uncaught Exception %s: "%s" at %s line %s', get_class($e), $e->getMessage(), $e->getFile(), $e->getLine()), array('exception' => (string) $e));
     //}
     parent::handleException($e);
 }
Beispiel #2
0
 /**
  * First sends the exception to Airbrake and then calls the parent method
  * @param Exception $exception
  */
 protected function handleException(Exception $exception)
 {
     $client = $this->startClient();
     Yii::log('sending exception report to Airbrake');
     $client->notifyOnException($exception);
     parent::handleException($exception);
 }
 protected function handleException($exception)
 {
     if (!($exception instanceof CHttpException && $exception->statusCode == 404)) {
         Rollbar::report_exception($exception);
     }
     parent::handleException($exception);
 }
 protected function handleException($exception)
 {
     /* @var $client \AppEnlight\Client */
     $appEnlight = Yii::app()->getComponent('appenlight');
     /* initialziation */
     $client = $appEnlight->getClient();
     $appRequest = Yii::app()->getRequest();
     $appController = Yii::app()->getController();
     $category = 'exception.' . get_class($exception);
     if ($exception instanceof CHttpException) {
         $category .= '.' . $exception->statusCode;
     }
     /* report to be sent */
     $report = new AppEnlight\Endpoint\Data\Report();
     $report->setUsername($appEnlight->getUsername());
     /* get view name from action */
     if (isset($appController)) {
         $viewName = $appController->getViewPath();
     } elseif (Yii::app() instanceof CConsoleApplication) {
         $viewName = Yii::app()->getCommandPath();
     } else {
         $viewName = 'application.console';
     }
     $report->setViewName($viewName);
     /* getUrl doesn't exists in ConsoleApplication and causes errors */
     if (Yii::app() instanceof CConsoleApplication) {
         $report->setUrl($appEnlight->getHostName());
     } else {
         $report->setUrl($appEnlight->getHostName() . $appRequest->getUrl());
     }
     $report->setUserAgent($appRequest->getUserAgent());
     $report->setMessage($exception->__toString());
     $report->setRequestId($client->getUUID());
     $report->setError($exception->getMessage());
     $report->setHttpStatus($exception instanceof CHttpException ? $exception->statusCode : 500);
     $this->_processTrace($exception, $report);
     /* request is filled automatically */
     $request = new AppEnlight\Endpoint\Data\Report\Request();
     $report->setRequest($request);
     $client->addReport($report);
     $client->sendReports();
     parent::handleException($exception);
 }
 /**
  * Forwards an exception to Whoops.
  * @param Exception $exception
  */
 protected function handleException($exception)
 {
     if ($exception instanceof CHttpException && $this->errorAction !== null || !YII_DEBUG) {
         parent::handleException($exception);
         return;
     }
     $this->disableLogRoutes();
     $this->whoops->handleException($exception);
 }
 /**
  * @param \ErrorException $exception
  */
 protected function handleFatalError($exception)
 {
     \Rollbar::report_php_error($exception->getCode(), $exception->getMessage(), $exception->getFile(), $exception->getLine());
     parent::handleException($exception);
 }
Beispiel #7
0
 /**
  * Handles a thrown exception.  Will also log extra information if the exception happens to by a MySql deadlock.
  *
  * @param \Exception $exception The exception captured.
  *
  * @return null
  */
 protected function handleException($exception)
 {
     // Do some logging.
     if ($exception instanceof \HttpException) {
         $status = $exception->status ? $exception->{$status} : '';
         Craft::log(($status ? $status . ' - ' : '') . $exception->getMessage(), LogLevel::Warning);
     } else {
         if ($exception instanceof \Twig_Error) {
             Craft::log($exception->getRawMessage(), LogLevel::Error);
         } else {
             Craft::log($exception->getMessage(), LogLevel::Error);
         }
     }
     // Log MySQL deadlocks
     if ($exception instanceof \CDbException && strpos($exception->getMessage(), 'Deadlock') !== false) {
         $data = craft()->db->createCommand('SHOW ENGINE INNODB STATUS')->query();
         $info = $data->read();
         $info = serialize($info);
         Craft::log('Deadlock error, innodb status: ' . $info, LogLevel::Error, 'system.db.CDbCommand');
     }
     // If this is a Twig Runtime exception, use the previous one instead
     if ($exception instanceof \Twig_Error_Runtime) {
         if ($previousException = $exception->getPrevious()) {
             $exception = $previousException;
         }
     }
     // Special handling for Twig syntax errors
     if ($exception instanceof \Twig_Error) {
         $this->handleTwigError($exception);
     } else {
         if ($exception instanceof DbConnectException) {
             $this->handleDbConnectionError($exception);
         } else {
             parent::handleException($exception);
         }
     }
 }
 /**
  * Handles the exception.
  * @param Exception $exception the exception captured.
  */
 protected function handleException($exception)
 {
     $this->getSentryClient()->captureException($exception);
     parent::handleException($exception);
 }