diff --git a/src/anonchat/__init__.py b/src/anonchat/__init__.py index c1f9775..eced8f7 100644 --- a/src/anonchat/__init__.py +++ b/src/anonchat/__init__.py @@ -96,8 +96,8 @@ with app.app_context(): def health_check(): return jsonify(status="healthy"), 200 -from . import error_handlers - +from .error_handlers import register_error_handlers +register_error_handlers(app) # Import routes from . import routes diff --git a/src/anonchat/error_handlers.py b/src/anonchat/error_handlers.py index 752be3d..2fa3d6e 100644 --- a/src/anonchat/error_handlers.py +++ b/src/anonchat/error_handlers.py @@ -24,4 +24,4 @@ def register_error_handlers(app): if request.is_json or request.headers.get('X-Requested-With') == 'XMLHttpRequest': return jsonify(error=title, message=message), status_code else: - return render_template('error.html', title=title, message=message), status_code \ No newline at end of file + return render_template('error.html', title=title, message=message, status_code=status_code), status_code \ No newline at end of file diff --git a/src/anonchat/templates/error.html b/src/anonchat/templates/error.html index 2e54cc4..c514a71 100644 --- a/src/anonchat/templates/error.html +++ b/src/anonchat/templates/error.html @@ -2,13 +2,10 @@ {% block title %}{{ title }}{% endblock %} -{% block header %} -

{{ title }}

-{% endblock %} - {% block content %}
-
Error
+
{{ status_code | default("Error") }}
+

{{ title }}

{{ message }}

Go to Home