diff --git a/lib/tools/Debug.class.php b/lib/tools/Debug.class.php index 3caa1d61..253c9bfb 100644 --- a/lib/tools/Debug.class.php +++ b/lib/tools/Debug.class.php @@ -2,24 +2,24 @@ class Debug { - public static function exceptionToString(Exception $e) + public static function exceptionToString(Throwable $e) { return static::getExceptionMessageWithoutTrace($e) . "\n" . static::getFullTrace($e); } - public static function getExceptionMessageWithoutTrace(Exception $e) + public static function getExceptionMessageWithoutTrace(Throwable $e) { return 'exception \'' . get_class($e) . '\' with message \'' . $e->getMessage() . '\' in ' . $e->getFile() . ':' . $e->getLine(); } /** * Same as the normal getTraceAsString(), but does not truncate long lines. - * @param Exception $exception + * @param Throwable $exception * @return string * @see http://stackoverflow.com/questions/1949345/how-can-i-get-the-full-string-of-phps-gettraceasstring/6076667#6076667 * @see https://gist.github.com/1437966 */ - public static function getFullTrace(Exception $exception) + public static function getFullTrace(Throwable $exception) { $rtn = ''; foreach ($exception->getTrace() as $count => $frame) diff --git a/web/index.php b/web/index.php index c56fb261..8f07dbcc 100644 --- a/web/index.php +++ b/web/index.php @@ -23,10 +23,15 @@ try } Controller::dispatch(strtok($_SERVER['REQUEST_URI'], '?')); } -catch(Exception $e) +catch(Throwable $e) { if (IS_PRODUCTION) { + $slackErrorNotificationUrl = Config::get('slack_error_notification_url'); + if ($slackErrorNotificationUrl) + { + Curl::post($slackErrorNotificationUrl, ['text' => ' ' . $e->__toString()], ['json_data' => true]); + } throw $e; }