Skip to content

Commit

Permalink
fix: log exception
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Feb 11, 2023
1 parent 9c289f7 commit f988c93
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions system/Debug/Exceptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,15 @@ public function exceptionHandler(Throwable $exception)

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

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(),
'exFile' => clean_path($exception->getFile()), // {file} refers to THIS file
'exLine' => $exception->getLine(), // {line} refers to THIS line
'trace' => self::renderBacktrace($exception->getTrace()),
]);
}

$this->request = Services::request();
$this->response = Services::response();

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

// For backward compatibility
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(),
'exFile' => clean_path($exception->getFile()), // {file} refers to THIS file
'exLine' => $exception->getLine(), // {line} refers to THIS line
'trace' => self::renderBacktrace($exception->getTrace()),
]);
}

if (! is_cli()) {
try {
$this->response->setStatusCode($statusCode);
Expand Down

0 comments on commit f988c93

Please sign in to comment.