From ab8a357137c074eaca68daa1e696c2e632d9c28d Mon Sep 17 00:00:00 2001 From: Cian Hughes Date: Fri, 6 Jun 2025 16:34:08 +0100 Subject: [PATCH] Added logger output on error 500 Cherry picked and tweaked from https://github.com/tu-graz-library/invenio-theme-tugraz/commit/fdec916528442fdafa19972353d9642c06db9106 --- invenio_theme_iform/__about__.py | 2 +- invenio_theme_iform/views.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/invenio_theme_iform/__about__.py b/invenio_theme_iform/__about__.py index 5d3e956..ddcbb56 100644 --- a/invenio_theme_iform/__about__.py +++ b/invenio_theme_iform/__about__.py @@ -8,4 +8,4 @@ """Metadata for this python module.""" -__version__ = "2025.6.6.3" +__version__ = "2025.6.6.4" diff --git a/invenio_theme_iform/views.py b/invenio_theme_iform/views.py index c967058..a6f782f 100644 --- a/invenio_theme_iform/views.py +++ b/invenio_theme_iform/views.py @@ -8,6 +8,7 @@ """invenio module for I-Form theme.""" +import traceback from functools import wraps from typing import Dict @@ -121,6 +122,10 @@ def default_error_handler(e: Exception): # - `e`, the passed-in exception # to get proxied-to objects: `flask.request._get_current_object()` + msg = f"default_error_handler of invenio-theme-iform captured following error type: { + type(e) + } with message {e} and stack trace {traceback.format_exc()}" + current_app.logger.error(msg) return render_template(current_app.config["THEME_500_TEMPLATE"]), 500