Show arguments of last function during error.
This commit is contained in:
parent
412d4e1a18
commit
31cecb5c90
6
app.py
6
app.py
|
@ -15,6 +15,7 @@ from sqlalchemy.orm import aliased
|
||||||
from sqlalchemy.sql.expression import desc
|
from sqlalchemy.sql.expression import desc
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
import inspect
|
||||||
import itertools
|
import itertools
|
||||||
import hashlib
|
import hashlib
|
||||||
import json
|
import json
|
||||||
|
@ -79,7 +80,10 @@ 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()
|
||||||
return render_template('show_error.html', tb=tb), 500
|
last_frame_args = inspect.getargs(tb.frames[-1].code)
|
||||||
|
return render_template('show_error.html',
|
||||||
|
tb=tb,
|
||||||
|
last_frame_args=last_frame_args), 500
|
||||||
|
|
||||||
@app.template_global()
|
@app.template_global()
|
||||||
def set_url_args(endpoint=None, **new_args):
|
def set_url_args(endpoint=None, **new_args):
|
||||||
|
|
|
@ -9,7 +9,11 @@
|
||||||
|
|
||||||
<h1>Software error: {{ tb.exception_type }}</h1>
|
<h1>Software error: {{ tb.exception_type }}</h1>
|
||||||
<div>
|
<div>
|
||||||
<p>{{ tb.exception }}</p>
|
<pre>{{ tb.exception }}</pre>
|
||||||
|
|
||||||
|
<p>Error in function "{{ tb.frames[-1].function_name }}":
|
||||||
|
{{ last_frame_args | pprint }}</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% set body %}
|
{% set body %}
|
||||||
|
|
Loading…
Reference in a new issue