Skip to content

Commit

Permalink
fix: recursive error while rendering flexmeasures_template
Browse files Browse the repository at this point in the history
Signed-off-by: F.N. Claessen <[email protected]>
  • Loading branch information
Flix6x committed Jan 2, 2025
1 parent 79352c0 commit ab8fe03
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions flexmeasures/ui/error_handlers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Error views for UI purposes."""

from flask import Flask
from flask import Flask, render_template
from werkzeug.exceptions import BadRequest, InternalServerError, HTTPException

from flexmeasures.ui.utils.view_utils import render_flexmeasures_template
Expand All @@ -24,15 +24,16 @@ def handle_generic_http_exception(e: HTTPException):
if hasattr(e, "code") and e.code is not None:
error_code = e.code
error_text = getattr(e, "description", str(e))
return (
render_flexmeasures_template(
"error.html",
error_class=e.__class__.__name__,
error_description="We encountered an Http exception.",
error_message=error_text,
),
error_code,
kwargs = dict(
"error.html",
error_class=e.__class__.__name__,
error_description="We encountered an Http exception.",
error_message=error_text,
)
try:
return (render_flexmeasures_template(**kwargs), error_code)
except Exception: # noqa: B902
return (render_template(**kwargs), error_code)


def handle_500_error(e: InternalServerError):
Expand Down

0 comments on commit ab8fe03

Please sign in to comment.