Permalink
Browse files

Added support for handling fatal errors

  • Loading branch information...
1 parent 9c8015e commit 1c0cef6141a21052b086b626b170e872130c3694 Robert Rotarius committed Jan 26, 2011
Showing with 13 additions and 0 deletions.
  1. +13 −0 Services/Hoptoad.php
View
@@ -82,6 +82,7 @@ public static function installHandlers($apiKey=NULL, $environment=NULL, $client=
**/
public function installNotifierHandlers()
{
+ register_shutdown_function(array($this, "fatalErrorHandler"));
set_error_handler(array($this, "errorHandler"));
set_exception_handler(array($this, "exceptionHandler"));
}
@@ -146,6 +147,18 @@ public function exceptionHandler($exception)
{
$this->notify(get_class($exception), $exception->getMessage(), $exception->getFile(), $exception->getLine(), $exception->getTrace());
}
+
+ /**
+ * Handle fatal errors
+ *
+ * @return void
+ * @author Robert Rotarius
+ */
+ public function fatalErrorHandler()
+ {
+ $error = error_get_last();
+ $this->notify($error['type'], $error['message'], $error['file'], $error['line'], debug_backtrace());
+ }
/**
* Set the values to be used for the next notice sent to Hoptoad

0 comments on commit 1c0cef6

Please sign in to comment.