From b0c8cf2ecda23045d725aaf43cfb3852ed766a4b Mon Sep 17 00:00:00 2001 From: slawkens Date: Sun, 29 Dec 2024 15:45:33 +0100 Subject: [PATCH] Add $whoopsHandler as variable, can be used by other scripts --- system/exception.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/system/exception.php b/system/exception.php index 94b60c47..c2f1f52c 100644 --- a/system/exception.php +++ b/system/exception.php @@ -9,16 +9,16 @@ */ use MyAAC\Exceptions\SensitiveException; +use Whoops\Handler\PlainTextHandler; +use Whoops\Handler\PrettyPageHandler; +use Whoops\Run; -if (class_exists(\Whoops\Run::class)) { - $whoops = new \Whoops\Run; - if(IS_CLI) { - $whoops->pushHandler(new \Whoops\Handler\PlainTextHandler); - } - else { - $whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler); - } +if (class_exists(Run::class)) { + $whoops = new Run; + $whoopsHandler = IS_CLI ? (new PlainTextHandler()) : (new PrettyPageHandler()); + + $whoops->pushHandler($whoopsHandler); $whoops->register(); return; }