static protected function formatExceptionMessage(\Exception $exception)
    {

        $errorFullText = '<div><b>New ' . get_class($exception) . '</b></div>';
        $errorFullText .= '<div><b>File:</b> ' . $exception->getFile() . '</div>';
        $errorFullText .= '<div><b>Line:</b> ' . $exception->getLine() . '</div>';
        $errorFullText .= '<div><b>Message:</b> ' . $exception->getMessage() . '</div>';

        $trace = $exception->getTrace();

        if (get_class($exception) != 'DebugException') {
            array_unshift($trace, array('file' => $exception->getFile(), 'line' => $exception->getLine(), 'function' => 'throw ' . get_class($exception), 'args' => array($exception->getMessage(), $exception->getCode())));
        }

        $traceString = '';
        foreach ($trace as $tTraceItem) {

            if (empty ($tTraceItem ['file'])) {
                $tTraceItem ['file'] = '';
            }
            if (empty ($tTraceItem ['line'])) {
                $tTraceItem ['line'] = '';
            }

            $traceString .= '<li>' . basename($tTraceItem ['file']) . " at line #" . $tTraceItem ['line'] . "\t";
            if (isset ($tTraceItem ['class'])) {
                $traceString .= $tTraceItem ['class'] . '::' . $tTraceItem ['function'] . '(';
            } elseif (isset ($tTraceItem ['function'])) {
                $traceString .= $tTraceItem ['function'] . '(';
            }

            if (!empty ($tTraceItem ['args'])) {
                $separator = '';
                foreach ($tTraceItem ['args'] as $arg) {
                    $traceString .= $separator . self::getArgument($arg);
                    $separator = ', ';
                }
                $traceString .= ')';
            }
            $traceString .= "</li>";
        }

        $errorFullText .= '<div><b>Backtrace:</b> <ul style="margin: 0.2em;">' . $traceString . '</ul></div>';

        return $errorFullText;
    }