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 --- NEWS | 1 + public_html/index.php | 3 +++ 2 files changed, 4 insertions(+) diff --git a/NEWS b/NEWS index 20d415f71..ca67c6f6a 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ This file lists major, incompatible or otherwise important changes, you should look at it after every update. NEXT + - Log PublicApiException to error log 3.4.3 2019-12-07 - PHP 7.4 compatibility fixes 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