Permalink
Browse files

Adds support for handling fatal errors. From Magnetic@1c0cef6

  • Loading branch information...
aaronpk committed Jun 30, 2011
1 parent cd14967 commit 33bbe21f76ccf79b416571f15a407584c48cae16
Showing with 13 additions and 0 deletions.
  1. +13 −0 Services/Hoptoad.php
View
@@ -70,6 +70,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"));
}
@@ -135,6 +136,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
* @return void

0 comments on commit 33bbe21

Please sign in to comment.