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(),