From 43fce7916273254f16750a8d07ce5914f1e0de81 Mon Sep 17 00:00:00 2001 From: Thom Sentner Date: Fri, 30 Jul 2021 15:48:14 +0200 Subject: [PATCH] Correctly log werkzeug.exceptions.HTTPExceptions - closes #401 --- flask_monitoringdashboard/core/measurement.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/flask_monitoringdashboard/core/measurement.py b/flask_monitoringdashboard/core/measurement.py index 46eacfce4..5290cac51 100644 --- a/flask_monitoringdashboard/core/measurement.py +++ b/flask_monitoringdashboard/core/measurement.py @@ -110,7 +110,11 @@ def evaluate(route_handler, args, kwargs): return result, status_code, None except Exception as e: - return None, 500, e + try: + status_code = e.code + except AttributeError: + status_code = 500 + return None, status_code, e def add_wrapper1(endpoint, fun):