/** * Intercept exception handling to send a mail before continuing with the default logic * @see \Cake\Error\BaseErrorHandler::handleException() */ public function handleException(Exception $exception) { // send a debug mail with the fatal exception if ($this->email && !in_array(get_class($exception), $this->_skipExceptions)) { $this->email->debug('Application exception', Misc::dump($exception, $exception->getMessage(), true)); } // continue with exception handle logic parent::handleException($exception); }
/** * Handle uncaught exceptions. * * @param \Exception $exception Exception instance. * @return void * @throws \Exception When renderer class not found * @see http://php.net/manual/en/function.set-exception-handler.php */ public function handleException(Exception $exception) { $this->handle($exception); return parent::handleException($exception); }
/** * Handle uncaught exceptions. * * @param \Exception $exception Exception instance. * @return void * @throws \Exception When renderer class not found * @see http://php.net/manual/en/function.set-exception-handler.php */ public function handleException(Exception $exception) { $sentryHandler = new SentryHandler(); $sentryHandler->handle($exception); return parent::handleException($exception); }
/** * tests it is possible to load a plugin exception renderer * * @return void */ public function testLoadPluginHandler() { Plugin::load('TestPlugin'); $errorHandler = new ErrorHandler(['exceptionRenderer' => 'TestPlugin.TestPluginExceptionRenderer']); $error = new Error\NotFoundException('Kaboom!'); ob_start(); $errorHandler->handleException($error); $result = ob_get_clean(); $this->assertEquals('Rendered by test plugin', $result); Plugin::unload(); }
/** * Encount exception handler * * @access public * @author sakuragawa */ public function handleException(Exception $exception) { $exceptionName = get_class($exception); $this->execute($exception->getCode(), $exceptionName, $exception->getMessage(), $exception->getFile(), $exception->getLine()); parent::handleException($exception); }