]> git.wh0rd.org Git - tt-rss.git/blob - include/errorhandler.php
adjust scroll amount to trigger auto-opening next unread feed
[tt-rss.git] / include / errorhandler.php
1 <?php
2 function ttrss_error_handler($errno, $errstr, $file, $line, $context) {
3         global $logger;
4
5         if (error_reporting() == 0 || !$errno) return false;
6
7         $file = substr(str_replace(dirname(dirname(__FILE__)), "", $file), 1);
8
9         if (class_exists("Logger"))
10                 return Logger::get()->log_error($errno, $errstr, $file, $line, $context);
11 }
12
13 function ttrss_fatal_handler() {
14         global $logger;
15
16         $error = error_get_last();
17
18         if ($error !== NULL) {
19                 $errno = $error["type"];
20                 $file = $error["file"];
21                 $line = $error["line"];
22                 $errstr  = $error["message"];
23
24                 if (!$errno) return false;
25
26                 $context = debug_backtrace();
27
28                 $file = substr(str_replace(dirname(dirname(__FILE__)), "", $file), 1);
29
30                 if (class_exists("Logger"))
31                         return Logger::get()->log_error($errno, $errstr, $file, $line, $context);
32         }
33
34         return false;
35 }
36
37 register_shutdown_function('ttrss_fatal_handler');
38 set_error_handler('ttrss_error_handler');
39 ?>