Run error_log before sending error mail

This commit is contained in:
Joshua Ramon Enslin 2021-09-15 10:46:26 +02:00
parent 2fd7511218
commit 8394bf54b9
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE

View File

@ -222,6 +222,13 @@ final class MDErrorReporter {
*/ */
public function sendErrorReport(Throwable $exception, string $recipient, string $addDesc = ""):void { 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(); $subject = \get_class($exception) . ": " . $exception->getCode();
$description = $addDesc; $description = $addDesc;
@ -238,8 +245,6 @@ final class MDErrorReporter {
$additionalContextInfo $additionalContextInfo
); );
\error_log((string)$exception);
} }
/** /**