From 95799a5c7a483228592ea0dd1bb7cc3a372d9700 Mon Sep 17 00:00:00 2001 From: Jason Kelly Date: Sat, 20 Jan 2018 22:43:46 +0100 Subject: [PATCH] Fix: Fixed exception on non handled exception, and updated reporter logic with debug condition --- src/Exceptions/BaseException.php | 12 +++++++++--- src/Handlers/ExceptionHandler.php | 4 ++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Exceptions/BaseException.php b/src/Exceptions/BaseException.php index e694f89..fa2c8c2 100644 --- a/src/Exceptions/BaseException.php +++ b/src/Exceptions/BaseException.php @@ -204,7 +204,13 @@ private function parseCoreExceptionCode() $errorCodes = $config['error_codes']; - return $this->findExceptionCode($errorCodes); + $code = $this->findExceptionCode($errorCodes); + + if ($code === null) { + return 0; + } + + return $code; } /** @@ -268,9 +274,9 @@ public function setStatusCode(int $statusCode) } /** - * @return string + * @return string|null */ - public function getCoreExceptionCode(): string + public function getCoreExceptionCode(): ?string { return $this->coreExceptionCode; } diff --git a/src/Handlers/ExceptionHandler.php b/src/Handlers/ExceptionHandler.php index 052c3af..575f636 100644 --- a/src/Handlers/ExceptionHandler.php +++ b/src/Handlers/ExceptionHandler.php @@ -86,6 +86,10 @@ public function report(Exception $exception) return parent::report($exception); } + if (env('APP_DEBUG', false)) { + return null; + } + if (method_exists($exception, 'getSeverity')) { $severity = $exception->getSeverity(); }