Improve error reporting.

This commit is contained in:
Edward Betts 2019-09-29 08:27:35 +01:00
parent 37af9ad1c0
commit 37e119f71d
3 changed files with 124 additions and 0 deletions

7
app.py
View file

@ -7,6 +7,8 @@ from depicts import (utils, wdqs, commons, mediawiki, painting, saam, database,
from depicts.model import DepictsItem, DepictsItemAltLabel, Edit
from requests_oauthlib import OAuth1Session
from urllib.parse import urlencode
from werkzeug.exceptions import InternalServerError
from werkzeug.debug.tbtools import get_current_traceback
import requests.exceptions
import requests
import lxml.html
@ -107,6 +109,11 @@ select distinct ?item where {
}
'''
@app.errorhandler(InternalServerError)
def exception_handler(e):
tb = get_current_traceback()
return render_template('show_error.html', tb=tb), 500
@app.template_global()
def set_url_args(**new_args):
args = request.view_args.copy()