@unhandled_exception. Outputting unhandled errors

If an error has not been handled by any of the handlers (see operator try), Parser calls method unhandled_exception, This method receives information on the error as well as the stack of calls that caused it. The method's work results in a custom message to be output to a visitor. The error is also recorded in server's error log.

The
unhandled_exception message would look best if framed within usual layout of your site. It would be also good if you check technical details and hide them from your visitors.

We recommend placing this method in your site's configuration file.

There is a way to prevent recording an error into error log. Only for particular errors set this flag on:
$exception.handled(true)    [3.1.4]

Example
@unhandled_exception[exception;stack]
$
response:content-type[
        $.value[text/html]
        $.charset[
$response:charset]
]

<title>UNHANDLED EXCEPTION (root)</title>
<body bgcolor=white>
<font color=black>
<pre>
^
untaint[html]{$exception.comment}</pre>
^
if(
def $exception.source){
   
<b>$exception.source</b><br />
   
<pre>^untaint[html]{$exception.file^($exception.lineno^)}</pre>
}
^if(def $exception.type){
exception.type=$exception.type}
^if($stack){
   <hr />
   ^stack.
menu{
      
<tt>$stack.name</tt> $stack.file^($stack.lineno^)<br />
   }
}



Copyright © 1997–2017 Art. Lebedev Studio | http://www.artlebedev.com Last updated: 21.09.2007