diff --git a/src/Core/Log.php b/src/Core/Log.php index dafdf7df89..1b6a13b3de 100644 --- a/src/Core/Log.php +++ b/src/Core/Log.php @@ -31,6 +31,7 @@ namespace App\Core; +use App\Util\Exception\ServerException; use Psr\Log\LoggerInterface; abstract class Log @@ -42,6 +43,13 @@ abstract class Log self::$logger = $l; } + public static function unexpected_exception(\Exception $e) + { + $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2); + self::critical('Unexpected exception of class: "' . get_class($e) . '" was thrown in ' . get_called_class() . '::' . $backtrace[1]['function']); + throw new ServerException('Unexpected exception', 500, $e); + } + /** * Simple static wrappers around Monolog's functions */