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)
|
||||
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()
|
||||
|
|
|
@ -11,9 +11,10 @@
|
|||
<div>
|
||||
<pre>{{ tb.exception }}</pre>
|
||||
|
||||
<p>Error in function "{{ tb.frames[-1].function_name }}":
|
||||
{{ last_frame_args | pprint }}</p>
|
||||
|
||||
<p>Error in function "{{ tb.frames[-1].function_name }}"<br>
|
||||
{{ last_frame_args | pprint }}<br>
|
||||
locals: {{ last_frame.locals | pprint }}
|
||||
<p>
|
||||
</div>
|
||||
|
||||
{% set body %}
|
||||
|
|
Loading…
Reference in a new issue