Skip to content

Commit 43cf748

Browse files
authored
Merge pull request #7341 from kenjis/fix-exceptionHandler-show-first-exception
fix: use first exception in exceptionHandler()
2 parents c4ff7c7 + 2a7f2f7 commit 43cf748

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

system/Debug/Exceptions.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,11 @@ public function exceptionHandler(Throwable $exception)
119119

120120
[$statusCode, $exitCode] = $this->determineCodes($exception);
121121

122+
// Get the first exception.
123+
while ($prevException = $exception->getPrevious()) {
124+
$exception = $prevException;
125+
}
126+
122127
if ($this->config->log === true && ! in_array($statusCode, $this->config->ignoreCodes, true)) {
123128
log_message('critical', "{message}\nin {exFile} on line {exLine}.\n{trace}", [
124129
'message' => $exception->getMessage(),

0 commit comments

Comments
 (0)