mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2025-06-15 18:40:40 +00:00
Move jobs namespace back to http routes
This commit is contained in:
@ -4,11 +4,17 @@ from . import bp
|
||||
|
||||
|
||||
@bp.app_errorhandler(HTTPException)
|
||||
def handle_http_exception(error):
|
||||
def handle_http_exception(e: HTTPException):
|
||||
''' Generic HTTP exception handler '''
|
||||
accept_json = request.accept_mimetypes.accept_json
|
||||
accept_html = request.accept_mimetypes.accept_html
|
||||
|
||||
if accept_json and not accept_html:
|
||||
response = jsonify(str(error))
|
||||
return response, error.code
|
||||
return render_template('errors/error.html.j2', error=error), error.code
|
||||
error = {
|
||||
'code': e.code,
|
||||
'name': e.name,
|
||||
'description': e.description
|
||||
}
|
||||
return jsonify(error), e.code
|
||||
|
||||
return render_template('errors/error.html.j2', error=e), e.code
|
||||
|
Reference in New Issue
Block a user