From 2a7f2f73ed91f92f5b022773bb69cc0534537d12 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 7 Mar 2023 09:10:30 +0900 Subject: [PATCH] fix: use first exception in exceptionHandler() --- system/Debug/Exceptions.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/system/Debug/Exceptions.php b/system/Debug/Exceptions.php index 143d17ed56a3..531e95fd9808 100644 --- a/system/Debug/Exceptions.php +++ b/system/Debug/Exceptions.php @@ -119,6 +119,11 @@ public function exceptionHandler(Throwable $exception) [$statusCode, $exitCode] = $this->determineCodes($exception); + // Get the first exception. + while ($prevException = $exception->getPrevious()) { + $exception = $prevException; + } + if ($this->config->log === true && ! in_array($statusCode, $this->config->ignoreCodes, true)) { log_message('critical', "{message}\nin {exFile} on line {exLine}.\n{trace}", [ 'message' => $exception->getMessage(),