Adds an exception to be profiled in the debug bar

@param GeneratedError $e
497145
public function addError(GeneratedError $e)
    {
        $this->errors[] = $e;
        if ($this->chainErrors && $previous = $e->getPrevious()) {
            $this->addError($previous);
        }
    }
164245
public function setExceptionMessages(Exception $e)
    {
        $this->flashMessenger()->addErrorMessage([
            'message' => $e->getMessage(),
            'title' => 'Error!'
        ]);

        $prevException = $e->getPrevious();

        if ($prevException) {
            while ($prevException) {
                $this->flashMessenger()->addErrorMessage($prevException->getMessage());
                $prevException = $prevException->getPrevious();
            }
        }
    }
407601
public function exception($e)
    {
        $this->setParams(
            $e->getCode(),
            $e->getMessage(),
            $e->getFile(),
            $e->getLine(),
            $e->getTraceAsString());

        return $this->render();
    }
202315
private function handleExternalError(\Exception $e) {
        $reflection = new \ReflectionClass($e);
        echo '<header>';
            echo '<h1>Exception: ' . $reflection->getName() . '</h1>';
            echo '<h2>Message: ' . $e->getMessage() . '</h2>';
            echo '<h3>' . $e->getFile() . ':' . $e->getLine() . '</h3>';
        echo '</header>';
        if ( method_exists($e, 'getContext') ) {
            echo 'Debug:';
            !d( $e->getContext() );
        }
    }
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.';
	}
814512
protected function handleError(Exception $e)
    {
        if($this->isCli){
            $errorCode = $e->getCode();
            exit((empty($errorCode)) ? 1 : $errorCode);	//exit the program with an error
        }
        else {
            throw new Exception($e->getMessage());
        }
    }
1184242
public static function display( Exception $e )
	{
		$view	= UI_HTML_Exception_View::render( $e );
		print( self::wrapExceptionView( $view ) );
	}
131375
protected function renderException($output, \Exception $e)
    {
        $this->laravel[ExceptionHandler::class]->renderForConsole($output, $e);
    }
638829
public function renderException(\Exception $e, OutputInterface $output)
    {
        parent::renderException($e, $output);

        if (is_callable($this->exceptionHandler)) {
            try {
                if (method_exists($this->exceptionHandler, '__invoke')) {
                    $this->exceptionHandler->__invoke($e);
                } else {
                    call_user_func($this->exceptionHandler, $e);
                }
            } catch (\Exception $e) {
            }
        }
    }
604598
public function renderException(\Exception $e, OutputInterface $output)
    {
        $output->writeln('', OutputInterface::VERBOSITY_QUIET);

        $this->doRenderException($e, $output);

        if (null !== $this->runningCommand) {
            $output->writeln(sprintf('<info>%s</info>', sprintf($this->runningCommand->getSynopsis(), $this->getName())), OutputInterface::VERBOSITY_QUIET);
            $output->writeln('', OutputInterface::VERBOSITY_QUIET);
        }
    }
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);
    }
209466
public function setException(exception $e)
    {
        if (isset($this->response)) {
            $this->response->setException($e);
        } else {
            throw $e;
        }
    }
1300992
public function logDebugException(\Exception $e)
    {
        if ($this->getServerContext()->hasLogger(LoggerUtils::SYSTEM)) {
            $this->getServerContext()->getLogger(LoggerUtils::SYSTEM)->debug($e->__toString());
        }
    }
860763
protected function _displayException($exception)
    {
        $rendererClassName = App::className($this->_options['exceptionRenderer'], 'Error');
        try {
            if (!$rendererClassName) {
                throw new Exception("$rendererClassName is an invalid class.");
            }
            /** @var \Cake\Error\ExceptionRendererInterface $renderer */
            $renderer = new $rendererClassName($exception);
            $response = $renderer->render();
            $this->_clearOutput();
            $this->_sendResponse($response);
        } catch (Throwable $exception) {
            $this->_logInternalError($exception);
        } catch (Exception $exception) {
            $this->_logInternalError($exception);
        }
    }
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]);
    }
71413
public function exception(\Exception $e): void
    {
        $this->log(
            configDefault('exception', 'log', 'exception') ?: 'exception',
            dump($_REQUEST, 'REQUEST', true) . PHP_EOL . var_export($e, true)
        );
    }
1021376
public function handleException(\Throwable $e): void
    {
        if (!$this->get('error.log', false)) {
            return;
        }

        // Do not log 4xx errors
        $code = $e->getCode();

        if ($code < 400 || $code >= 500) {
            $message = sprintf(
                'Code: %s - %s - File: %s (%d)',
                $e->getCode(),
                $e->getMessage(),
                $e->getFile(),
                $e->getLine()
            );

            $traces = '';

            foreach (BacktraceHelper::normalizeBacktraces($e->getTrace()) as $i => $trace) {
                $traces .= '    #' . ($i + 1) . ' - ' . $trace['function'] . ' ' . $trace['file'] . "\n";
            }

            $this->logger->createRotatingLogger('console-error', Core\Logger\Logger::DEBUG)
                ->error($message . "\n" . $traces, ['exception' => $e]);
        }
    }