Simplify ExceptionHandler
This commit is contained in:
parent
f907f2fb3a
commit
499ff85f63
1 changed files with 17 additions and 9 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue