feat: improve error handling (#2902)

This commit is contained in:
Dag 2022-07-08 20:39:13 +02:00 committed by GitHub
parent c992bcc8bf
commit abc4af43b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 180 additions and 254 deletions

View file

@ -26,7 +26,18 @@ try {
}
} catch (\Throwable $e) {
error_log($e);
$message = sprintf(
'Uncaught Exception %s: %s at %s line %s',
get_class($e),
$e->getMessage(),
trim_path_prefix($e->getFile()),
$e->getLine()
);
http_response_code(500);
print render('error.html.php', [
'message' => sprintf("Uncaught Exception %s: '%s'\n", get_class($e), $e->getMessage()),
'message' => $message,
'stacktrace' => create_sane_stacktrace($e),
]);
}