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);
    }