From ddf6734dfeac65babf096a3147338f54d712b6e3 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 19 Apr 2020 11:53:01 +0200 Subject: 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 --- public_html/index.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'public_html') 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) { -- cgit v1.2.3-24-g4f1b