Show locals in last frame during traceback.
This commit is contained in:
parent
19c4a7d221
commit
849aa57780
4
app.py
4
app.py
|
@ -80,9 +80,11 @@ def shutdown_session(exception=None):
|
||||||
@app.errorhandler(InternalServerError)
|
@app.errorhandler(InternalServerError)
|
||||||
def exception_handler(e):
|
def exception_handler(e):
|
||||||
tb = get_current_traceback()
|
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',
|
return render_template('show_error.html',
|
||||||
tb=tb,
|
tb=tb,
|
||||||
|
last_frame=last_frame,
|
||||||
last_frame_args=last_frame_args), 500
|
last_frame_args=last_frame_args), 500
|
||||||
|
|
||||||
@app.template_global()
|
@app.template_global()
|
||||||
|
|
|
@ -11,9 +11,10 @@
|
||||||
<div>
|
<div>
|
||||||
<pre>{{ tb.exception }}</pre>
|
<pre>{{ tb.exception }}</pre>
|
||||||
|
|
||||||
<p>Error in function "{{ tb.frames[-1].function_name }}":
|
<p>Error in function "{{ tb.frames[-1].function_name }}"<br>
|
||||||
{{ last_frame_args | pprint }}</p>
|
{{ last_frame_args | pprint }}<br>
|
||||||
|
locals: {{ last_frame.locals | pprint }}
|
||||||
|
<p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% set body %}
|
{% set body %}
|
||||||
|
|
Loading…
Reference in a new issue