public static function exception_handler($exception)
{
if (isset($exception->is_error) && $exception->is_error) {
return;
}
printf("<pre class=\"error\">\n<b>%s:</b> %s in %s line %s\n</pre>", get_class($exception), $exception->getMessage(), $exception->getFile(), $exception->getLine());
if (DEBUG) {
self::print_backtrace($exception->getTrace());
}
if (Options::get('log_backtraces') || DEBUG) {
$backtrace = print_r($exception->getTrace(), true);
} else {
$backtrace = null;
}
EventLog::log($exception->getMessage() . ' in ' . $exception->getFile() . ':' . $exception->getLine(), 'err', 'default', null, $backtrace);
}