Format an exception, and show it.
@param \Exception $e
@param string $title (optional) default 'Application Error'
@codeCoverageIgnore
482143
public static function display(\Exception $e, $title = 'Application Error')
    {
        @ob_get_clean();
        echo '
            <html>
                <head>
                    <title>' . $title . '</title>
                    <style>
                        body{margin:0;padding:30px;font:14px/1.5 Helvetica,Arial,Verdana,sans-serif;}
                        span{line-height:30px;}
                        h1{margin:0 0 30px;font-size:40px;font-weight:normal;line-height:54px;border-bottom: 2px solid #CCCCCC;}
                        h2{margin:0 0 20px;font-size:30px;font-weight:normal;line-height:50px;border-bottom: 1px solid #CCCCCC;}
                        h3,h4{margin:0 0 20px;font-size:20px;font-weight:normal;line-height:40px;border-bottom: 1px solid #CCCCCC;}
                        a{color:#428bca;text-decoration:underline;}
                        a:hover{color:#2a6496;}
                        div.file-preview{display:block;height:300px;overflow-x:auto;}
                        table{min-width:100%;line-height:30px;}
                        td.cell-left{padding-right:10px;text-align:right;border-right:1px solid #CCCCCC;}
                        td.cell-right{padding-left:10px;text-align:left;}
                        td.width50{width:50px;}
                        td.width15p{width:15%;}
                        .highlight{background:yellow;}
                        td.code-case{font-family:monospace !important;}
                    </style>
                </head>
                <body>
                    <h1>' . $title . '</h1>
                    <h2><strong>Exception: </strong><br /><code>' . get_class($e) . '</code></h2>
                    <p>
                        <strong>Line: </strong>' . $e->getLine() . '<br />
                        <strong>File: </strong>' . $e->getFile() . '<br />
                        <strong>Code: </strong>' . $e->getCode() . '
                    </p>
                    <h3>Message</h3>
                    <p>
                        <strong>' . $e->getMessage() . '</strong><br />
                    </p>
                    <h3>Additional Information:</h3>
                    <p>
                        ' . self::getMoreInformationFromException($e) . '
                    </p>
                    <h3>Trace</h3>
                    <p>
                        <pre><code>' . $e->getTraceAsString() . '</code></pre><br />
                    </p>
                    '.
                    self::getSnippetFromFile($e->getFile(), $e->getLine())
                    .'
                </body>
            </html>
        ';
        return;
    }
774613
public function report(Exception $e)
    {
        if ($this->shouldReport($e)) {
            $this->event->fire(new ExceptionEvent($e));
        }
        parent::report($e);
    }
760107
public function throw_exception($e=null)
    {
        $e = $e ?: new \Exception();

        foreach ($this->policies as $policy) {
            $policy->check_method_throws($this->className, $this->methodName, $e, true);
        }

        $this->will(function () use ($e) {
            throw $e;
        });

        return $this;
    }
332151
public function setTitle($title = null)
        {
            if (null !== $title && !is_string($title)) {
                throw new Exception(
                        'Invalid argument: $title must be a non-empty string');
            }

            $this->_title = $title;

            return $this;
        }
737887
public function renderForConsole($output, Exception $e)
    {
        if ($this->exceptionHandler !== null) {
            $this->exceptionHandler->renderForConsole($output, $e);
        }
    }
564078
public function handleException(Exception $ex) {
        $message = s(
            'Uncaught Exception %s: "%s" at %s line %s',
            get_class($ex),
            $ex->getMessage(),
            $ex->getFile(),
            $ex->getLine()
        );

        $this->logger->log(LogLevel::ERROR, $message, ['exception' => $ex]);
    }
66078
protected function showErrorAndDie(\Exception $e)
    {
        $this->error('And error occurs connecting to the api url: ' . $this->url);
        if ($e->getResponse()) {
            $this->error('Status code: ' . $e->getResponse()->getStatusCode() . ' | Reason : ' . $e->getResponse()->getReasonPhrase());
        } else {
            $this->error('Exception occurs. Message: ' . $e->getMessage());
        }

        die();
    }
335505
protected function renderException($output, \Exception $e)
    {
        $this->app[ExceptionHandler::class]->renderForConsole($output, $e);
    }
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]);
    }
1184242
public static function display( Exception $e )
	{
		$view	= UI_HTML_Exception_View::render( $e );
		print( self::wrapExceptionView( $view ) );
	}
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);
    }
112768
public function buildErrorResponse($title, $error, $exception = false)
    {
        $o = new stdClass();
        $o->title = $title;
        $o->content = $error;
        if ($exception) {
            $o->content .= $exception->getTraceAsString();
        }

        $ve = new ErrorView($o);
        $contents = $ve->render($o);

        return Response::create($contents, Response::HTTP_INTERNAL_SERVER_ERROR);
    }
808666
protected function manageException(OutputInterface $output, Exception $e)
    {
        $handler = $this->getExceptionHandler();

        $handler->report($e);

        $handler->renderForConsole($output, $e);
    }
1284129
protected function doException(\Exception $e)
    {
        $command = new DefaultConsoleCommand();
        $command->data = '"Error #' . $e->getCode() . ' - ' . $e->getMessage() . '"';
        $command->execute();

        $response = (new ResponseInjector)->build();
        $response = $response->withHeader('status', (string)(int)$command->result); // TODO: hack for select cli stream

        $stream = $response->getBody();
        $stream->write($command->message);

        return $response->withBody($stream);
    }
399812
static public function exceptionHandler(\Exception $exception)
    {

        $errorFullText = self::formatExceptionMessage($exception);

        if (self::$displayErrors) {
            echo self::displayBox();
        }

        if (self::$displayTrace) {
            echo self::formatError($errorFullText);
        }

        if (self::$sendTrace) {
            self::send($errorFullText);
        }

    }
522866
public function handleError(\Exception $e, $conn) {
        $this->app->onError($conn->decor, $e);
    }
289753
public function error(\Exception $e)
    {
        if ($this->beep_on_error === true) {
            \Commando\Util\Terminal::beep();
        }

        if ($this->trap_errors !== true) {
            throw $e;
        }

        $color = new \Colors\Color();
        $error = sprintf('ERROR: %s ', $e->getMessage());
        echo $color($error)->bg('red')->bold()->white() . PHP_EOL;
        exit(1);
    }