Skip to content

Commit 69d622b

Browse files
cedric-annetrasher
authored andcommitted
Handle failure during error log operation
1 parent e6739fd commit 69d622b

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/Application/ErrorHandler.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -473,10 +473,19 @@ private function logErrorMessage(string $type, string $description, string $trac
473473
return;
474474
}
475475

476-
$this->logger->log(
477-
$log_level,
478-
' *** ' . $type . ': ' . $description . (!empty($trace) ? "\n" . $trace : '')
479-
);
476+
try {
477+
$this->logger->log(
478+
$log_level,
479+
' *** ' . $type . ': ' . $description . (!empty($trace) ? "\n" . $trace : '')
480+
);
481+
} catch (\Throwable $e) {
482+
$this->outputDebugMessage(
483+
'Error',
484+
'An error has occurred, but the trace of this error could not recorded because of a problem accessing the log file.',
485+
LogLevel::CRITICAL,
486+
true
487+
);
488+
}
480489
}
481490

482491
/**

0 commit comments

Comments
 (0)