From 120b1ef1eda3b53a391e99f789914be52ae51313 Mon Sep 17 00:00:00 2001 From: Hanne Moa Date: Fri, 24 Jan 2025 15:19:24 +0100 Subject: [PATCH] hide exception without args --- src/argus/htmx/middleware.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/argus/htmx/middleware.py b/src/argus/htmx/middleware.py index 5877cf7c3..7b47940e4 100644 --- a/src/argus/htmx/middleware.py +++ b/src/argus/htmx/middleware.py @@ -67,7 +67,9 @@ class HtmxMessageMiddleware(MiddlewareMixin): TEMPLATE = "messages/_notification_messages_htmx_append.html" def process_exception(self, request, exception): - error_msg = f"500 Internal Server Error: {exception}" + error_msg = "500 Internal Server Error" + if str(exception): + error_msg += f": {exception}" messages.error(request, error_msg) LOG.error(error_msg) return None