Skip to content

Commit f988c93

Browse files
committed
fix: log exception
1 parent 9c289f7 commit f988c93

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

system/Debug/Exceptions.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,15 @@ public function exceptionHandler(Throwable $exception)
123123

124124
[$statusCode, $exitCode] = $this->determineCodes($exception);
125125

126+
if ($this->config->log === true && ! in_array($statusCode, $this->config->ignoreCodes, true)) {
127+
log_message('critical', "{message}\nin {exFile} on line {exLine}.\n{trace}", [
128+
'message' => $exception->getMessage(),
129+
'exFile' => clean_path($exception->getFile()), // {file} refers to THIS file
130+
'exLine' => $exception->getLine(), // {line} refers to THIS line
131+
'trace' => self::renderBacktrace($exception->getTrace()),
132+
]);
133+
}
134+
126135
$this->request = Services::request();
127136
$this->response = Services::response();
128137

@@ -141,15 +150,6 @@ public function exceptionHandler(Throwable $exception)
141150
}
142151

143152
// For backward compatibility
144-
if ($this->config->log === true && ! in_array($statusCode, $this->config->ignoreCodes, true)) {
145-
log_message('critical', "{message}\nin {exFile} on line {exLine}.\n{trace}", [
146-
'message' => $exception->getMessage(),
147-
'exFile' => clean_path($exception->getFile()), // {file} refers to THIS file
148-
'exLine' => $exception->getLine(), // {line} refers to THIS line
149-
'trace' => self::renderBacktrace($exception->getTrace()),
150-
]);
151-
}
152-
153153
if (! is_cli()) {
154154
try {
155155
$this->response->setStatusCode($statusCode);

0 commit comments

Comments
 (0)