Skip to content

Commit

Permalink
Always use the error template for unexpected exceptions
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
marcospri committed Feb 6, 2025
1 parent 97eef8d commit 4033c6b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lms/views/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 4033c6b

Please sign in to comment.