diff --git a/MDErrorReporter.php b/MDErrorReporter.php index eed645d..7f3045b 100644 --- a/MDErrorReporter.php +++ b/MDErrorReporter.php @@ -222,6 +222,13 @@ final class MDErrorReporter { */ public function sendErrorReport(Throwable $exception, string $recipient, string $addDesc = ""):void { + // First, write the error to the general error log. This should happen first, + // so that it will also work if there is a problem retrieving GPG keys. + + \error_log((string)$exception); + + // Second, a mail is generated and sent. + $subject = \get_class($exception) . ": " . $exception->getCode(); $description = $addDesc; @@ -238,8 +245,6 @@ final class MDErrorReporter { $additionalContextInfo ); - \error_log((string)$exception); - } /**