X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=include%2Ferrorhandler.php;h=95c9edc69df9ac7b8ad3f414741a844a88b3fe6c;hb=07fd4f8d9d4f301f5ad88ff9e80f042fc3eb0c36;hp=52431c2de41004ade39892b2289a9b28bd3e6861;hpb=15d52d51528be7301148d7739240cb1317c80847;p=tt-rss.git diff --git a/include/errorhandler.php b/include/errorhandler.php index 52431c2d..95c9edc6 100644 --- a/include/errorhandler.php +++ b/include/errorhandler.php @@ -1,17 +1,50 @@ log_error($errno, $errstr, $file, $line, $context); } function ttrss_fatal_handler() { - global $logger; + global $last_query; $error = error_get_last(); @@ -23,10 +56,12 @@ function ttrss_fatal_handler() { if (!$errno) return false; - $context = debug_backtrace(); + $context = format_backtrace(debug_backtrace()); $file = substr(str_replace(dirname(dirname(__FILE__)), "", $file), 1); + if ($last_query) $errstr .= " [Last query: $last_query]"; + if (class_exists("Logger")) return Logger::get()->log_error($errno, $errstr, $file, $line, $context); } @@ -36,4 +71,4 @@ function ttrss_fatal_handler() { register_shutdown_function('ttrss_fatal_handler'); set_error_handler('ttrss_error_handler'); -?> +