don't error if we can't load the ExceptionSerializer for early exceptions

Signed-off-by: Robin Appelman <robin@icewind.nl>
pull/31573/head
Robin Appelman 4 years ago
parent ee2f3bcaf1
commit 74f64fa3eb
No known key found for this signature in database
GPG Key ID: 42B69D8A64526EFB
  1. 8
      lib/private/Log.php

@ -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