From 4033c6bbd053caa02ae0b5b352212d963cae1614 Mon Sep 17 00:00:00 2001 From: Marcos Prieto Date: Tue, 4 Feb 2025 14:53:10 +0100 Subject: [PATCH] Always use the error template for unexpected exceptions Depending on when the exception has happened, the renderer might be set to a different one. Use the override to always use the basic error template. --- lms/views/exceptions.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lms/views/exceptions.py b/lms/views/exceptions.py index 171dcb8d95..ac7f80d7bf 100644 --- a/lms/views/exceptions.py +++ b/lms/views/exceptions.py @@ -105,6 +105,11 @@ def serializable_error(self): @exception_view_config(context=Exception) def error(self): + # Always use the error template. + # Depending on when the exception has happened, + # the renderer might be set to a different one + self.request.override_renderer = "lms:templates/error.html.jinja2" + LOG.exception("Unexpected error %s", type(self.exception)) return self.error_response( 500,