From 849aa577803e1a8eaa5106261f70828dd51c6649 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Tue, 7 Jan 2020 14:40:15 +0000 Subject: [PATCH] Show locals in last frame during traceback. --- app.py | 4 +++- templates/show_error.html | 7 ++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app.py b/app.py index db07845..4c83d8c 100755 --- a/app.py +++ b/app.py @@ -80,9 +80,11 @@ def shutdown_session(exception=None): @app.errorhandler(InternalServerError) def exception_handler(e): tb = get_current_traceback() - last_frame_args = inspect.getargs(tb.frames[-1].code) + last_frame = tb.frames[-1] + last_frame_args = inspect.getargs(last_frame.code) return render_template('show_error.html', tb=tb, + last_frame=last_frame, last_frame_args=last_frame_args), 500 @app.template_global() diff --git a/templates/show_error.html b/templates/show_error.html index 0c7a9af..a9159d0 100644 --- a/templates/show_error.html +++ b/templates/show_error.html @@ -11,9 +11,10 @@
{{ tb.exception }}
-

Error in function "{{ tb.frames[-1].function_name }}": - {{ last_frame_args | pprint }}

- +

Error in function "{{ tb.frames[-1].function_name }}"
+ {{ last_frame_args | pprint }}
+ locals: {{ last_frame.locals | pprint }} +

{% set body %}