Show last non library frame on error page

This commit is contained in:
Edward Betts 2020-01-08 15:38:59 +00:00
parent 6ba4fc7e35
commit 9bbbb45fbb

2
app.py
View file

@ -80,7 +80,7 @@ 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 = tb.frames[-1] last_frame = next(frame for frame in reversed(tb.frames) if not frame.is_library)
last_frame_args = inspect.getargs(last_frame.code) last_frame_args = inspect.getargs(last_frame.code)
return render_template('show_error.html', return render_template('show_error.html',
tb=tb, tb=tb,