diff options
author | Florian Pritz <bluewind@xinu.at> | 2020-04-19 11:53:01 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2020-04-19 13:35:37 +0200 |
commit | ddf6734dfeac65babf096a3147338f54d712b6e3 (patch) | |
tree | 10fbaa1c283e447af6ad5c71f608b30f4d20137c /public_html/index.php | |
parent | f70b518b503769c8453c9cee8b421189d59f268f (diff) |
Log HTTP 500 PublicApiException to error log
These return a 500 HTTP error code and when using a CLI download tool,
you might not see the returned HTML error message. To make debugging
easier we also log them to the error log.
Some extending exceptions also return different error codes (e.g.
UserInputException) so we filter these by only logging if the return
code is 500. If a user/admin sees that code they likely expect a log
entry.
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'public_html/index.php')
-rw-r--r-- | public_html/index.php | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/public_html/index.php b/public_html/index.php index dec18a8fd..aa9e12ec4 100644 --- a/public_html/index.php +++ b/public_html/index.php @@ -378,6 +378,9 @@ try { } redirect("user/login?redirect_uri=".$redirect_uri); } catch (\exceptions\PublicApiException $e) { + if ($e->get_http_error_code() == 500) { + \libraries\ExceptionHandler::log_exception($e); + } show_error(nl2br(htmlspecialchars($e->__toString())), $e->get_http_error_code()); } finally { if ($testname) { |