Browse Source

Merge pull request #31573 from nextcloud/exceptionserializer-load-fail

don't error if we can't load the ExceptionSerializer for early exceptions
tags/v24.0.0beta1
Robin Appelman 2 years ago
parent
commit
6c01863d39
No account linked to committer's email address
1 changed files with 7 additions and 1 deletions
  1. 7
    1
      lib/private/Log.php

+ 7
- 1
lib/private/Log.php View File

@@ -308,7 +308,13 @@ class Log implements ILogger, IDataLogger {
$app = $context['app'] ?? 'no app in context';
$level = $context['level'] ?? ILogger::ERROR;

$serializer = new ExceptionSerializer($this->config);
// if an error is raised before the autoloader is properly setup, we can't serialize exceptions
try {
$serializer = new ExceptionSerializer($this->config);
} catch (\Throwable $e) {
$this->error("Failed to load ExceptionSerializer serializer while trying to log " . $exception->getMessage());
return;
}
$data = $serializer->serializeException($exception);
$data['CustomMessage'] = $this->interpolateMessage($context, $context['message'] ?? '--');


Loading…
Cancel
Save