Phalcon\Utils\PrettyExceptions::handle PHP Method

handle() public method

Handles exceptions
public handle ( Exception $e, Phalcon\Mvc\Application $application = null ) : boolean
$e Exception
$application Phalcon\Mvc\Application OPTIONAL To display a dump of the current state of the Phalcon application instance.
return boolean
    public function handle($e, $application = null)
    {
        if (ob_get_level() > 0) {
            ob_end_clean();
        }
        if (self::$_showActive) {
            echo $e->getMessage();
            return;
        }
        self::$_showActive = true;
        echo '<html><head><title>Exception - ', get_class($e), ': ', $e->getMessage(), '</title>', $this->getCssSources(), '</head><body>';
        echo '<div class="error-main">
			', get_class($e), ': ', $e->getMessage(), '
			<br/><span class="error-file">', $e->getFile(), ' (', $e->getLine(), ')</span>
		</div>';
        if ($this->_showBackTrace) {
            echo '<div class="error-backtrace"><table cellspacing="0">';
            foreach ($e->getTrace() as $n => $trace) {
                $this->_showTraceItem($n, $trace);
            }
            echo '</table></div>';
        }
        echo $this->getApplicationDump($application);
        echo $this->getVersion();
        echo $this->getJsSources() . '</body></html>';
        self::$_showActive = false;
        return true;
    }