diff --git a/src/Runtime/Exceptions/ExceptionHandler.php b/src/Runtime/Exceptions/ExceptionHandler.php index a14528e..65ae4c6 100644 --- a/src/Runtime/Exceptions/ExceptionHandler.php +++ b/src/Runtime/Exceptions/ExceptionHandler.php @@ -52,19 +52,27 @@ class ExceptionHandler { }); } else { - self::$handler->pushHandler(new PrettyPageHandler()); - } - - if (Misc::isAjaxRequest()){ - self::$handler->pushHandler(new JsonResponseHandler()); - } - - if (Misc::isCommandLine()){ - self::$handler->pushHandler(new PlainTextHandler()); + self::$handler->pushHandler(self::handler()); } self::$handler->register(); } + /** + * @return Handler + */ + private static function handler() + { + if (Misc::isAjaxRequest()){ + return new JsonResponseHandler(); + } + + if (Misc::isCommandLine()){ + return new PlainTextHandler(); + } + + return new PrettyPageHandler(); + } + }