PHP Exception handler

@param   Exception  $e  the exception
@return  bool
506024
public static function exception_handler(\Exception $e)
	{
		if (method_exists($e, 'handle'))
		{
			return $e->handle();
		}

		$severity = ( ! isset(static::$levels[$e->getCode()])) ? $e->getCode() : static::$levels[$e->getCode()];
		logger(\Fuel::L_ERROR, $severity.' - '.$e->getMessage().' in '.$e->getFile().' on line '.$e->getLine());

		if (\Fuel::$env != \Fuel::PRODUCTION)
		{
			static::show_php_error($e);
		}
		else
		{
			static::show_production_error($e);
		}
	}
819987
protected function formatException(\Exception $e)
	{
		if ($this->debug)
		{
			$location = $e->getMessage().' in '.$e->getFile().':'.$e->getLine();

			return 'Error in exception handler: '.$location;
		}

		return 'Error in exception handler.';
	}
844262
protected function handleException($request, Exception $e)
    {
        $handler = $this->app->make(ExceptionHandler::class);

        return $handler->render($request, $e);
    }
1296551
public function handleException( \Throwable $e ) : bool
    {
        try{
            // Render exception
            $output = $this->renderer->output( $e );
    
            // make directory
            $dir = $this->file->getParent();
    
            if (!$dir->exists()){
                $dir->makeDirectory();
            }
    
            // output
            $this->file->putContents($output);
        }
        catch(\Throwable $e){
            exit($e->getMessage());
        }
    
        return true;
    }
1016695
public function handle(Exception $e)
    {
        $this->exception = $e;
        $this->notify($e);
        return $this->record($e);
    }
1285722
public function PHPExceptionHandler($exception)
    {
        session_write_close();
        $message = $exception->getMessage() . ' | File: {file} | Ln: {line} | ST: {stacktrace}';
        $context = array(
            'file' => $exception->getFile(),
            'line' => $exception->getLine(),
            'stacktrace' => $exception->getTraceAsString()
        );
        $this->logger->log($this->exceptionLogLevel, $message, $context);
    }
741506
protected function logException(\Exception $e)
    {
        $this->logger->log(call_user_func($this->exceptionLogFilter, $e), sprintf('%s: %s (uncaught exception) at %s line %s', get_class($e), $e->getMessage(), $e->getFile(), $e->getLine()), ['exception' => $e]);
    }
366730
public function on_exception( $e ) {

		// Log the PHP exception.
		do_action(
			\Inpsyde\Wonolog\LOG,
			new Log(
				$e->getMessage(),
				Logger::CRITICAL,
				Channels::PHP_ERROR,
				[
					'exception' => get_class( $e ),
					'file'      => $e->getFile(),
					'line'      => $e->getLine(),
					'trace'     => $e->getTraceAsString(),
				]
			)
		);

		// after logging let's reset handler and throw the exception
		restore_exception_handler();
		throw $e;
	}
254340
public static function handlerException(\Exception $e, $print = true)
    {
        $file = 'exception' . self::$_extenstion;

        $msg = self::_parseException($e, self::_skipFormating());

        self::_writeLog($file, $msg);
        self::_writeLogJson(get_class($e), $e->getMessage(), $e->getCode(), $e->getLine(), $e->getFile(), $e->getTrace());

        return $print ? print($msg) : true;
    }
99373
public function handle(Exception $ex) {
        if ( ! $this->supports($ex)) {
            return false;
        }

        $handled = $this->invokeHandler($this->getHandler(), $ex);

        return $handled === true ? true : false;
    }
417808
protected function dumpException(\Exception $e)
    {
        Logger::log('Starting dump exception');
        $ex = (NULL !== $e->getPrevious()) ? $e->getPrevious() : $e;
        $error = array(
            "error" => $ex->getMessage(),
            "file" => $ex->getFile(),
            "line" => $ex->getLine(),
        );
        Logger::log('Throwing exception', LOG_ERR, $error);
        unset($error);

        return $this->router->httpNotFound($ex);
    }
131728
function _exceptionHandler($exception)
    {
        $result['message'] = $exception->getMessage();

        if (self::$_config['errors']['exceptionBacktrace']) {
            $result['backtrace'] = $this->convertTrace($exception->getTrace());
        }

        $result['string'] = $exception->getTraceAsString();
        $result['code']   = $exception->getCode();

        if ($this->_isLiteMode()) {
            $this->_dumpRenderLite(PHP_EOL . $result['string'], '** EXCEPTION / ' . $this->_htmlChars($result['message']));

        } else {
            $this->_initAssets(true);
            $this->dump($result, '<b style="color:red;">**</b> EXCEPTION / ' . $this->_htmlChars($result['message']));
        }

        return true;
    }
90212
public function handleException($e)
    {
        if (!isset($this->route)) {
            return false;
        }
        return $this->route->handleException($e);
    }
339521
protected function handleException($passable, Exception $e)
    {
        if (! $this->container->bound(ExceptionHandler::class) ||
            ! $passable instanceof Request) {
            throw $e;
        }

        $handler = $this->container->make(ExceptionHandler::class);

        $handler->report($e);

        $response = $handler->render($passable, $e);

        if (method_exists($response, 'withException')) {
            $response->withException($e);
        }

        return $response;
    }
1168309
public function exception($exception)
    {
        try {
            foreach ($this->handlers as $handler) {
                $handler($exception);
            }
        } catch (\Throwable $e) {
            $msg = "Infinity loop in exception & error handler. \nMessage:\n" . $e;

            if ($this->app->get('system.debug')) {
                exit($msg);
            }

            exit($e->getMessage());
        }

        exit();
    }
741447
public function handleException( \Throwable $e ) : bool
    {
        // Render exception
        $output = $this->renderer->output( $e );
        
        // output
        $this->logger->error($output, [
            'exception' => $e,
        ]);
    
        return true;
    }
291559
public function _defaultExceptionHandler($e)
    {
        if (!headers_sent()) {
            header('HTTP/1.1 500 PHPTAL Exception');
            header('Content-Type:text/html;charset='.$this->encoding);
        }

        $line = $e->getFile();
        if ($e->getLine()) {
            $line .= ' line '.$e->getLine();
        }

        if (ini_get('display_errors')) {
            $title = get_class($e).': '.htmlspecialchars($e->getMessage());
            $body = "<p><strong>\n".htmlspecialchars($e->getMessage()).'</strong></p>' .
                    '<p>In '.htmlspecialchars($line)."</p><pre>\n".htmlspecialchars($e->getTraceAsString()).'</pre>';
        } else {
            $title = "PHPTAL Exception";
            $body = "<p>This page cannot be displayed.</p><hr/>" .
                    "<p><small>Enable <code>display_errors</code> to see detailed message.</small></p>";
        }

        echo "<!DOCTYPE html><html xmlns='http://www.w3.org/1999/xhtml'><head><style>body{font-family:sans-serif}</style><title>\n";
        echo $title.'</title></head><body><h1>PHPTAL Exception</h1>'.$body;
        error_log($e->getMessage().' in '.$line);
        echo '</body></html>'.str_repeat('    ', 100)."\n"; // IE won't display error pages < 512b
        exit(1);
    }