mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-25 02:44:18 +00:00
12 lines
404 B
Python
12 lines
404 B
Python
from flask import render_template, request
|
|
from werkzeug.exceptions import HTTPException
|
|
from . import bp
|
|
|
|
|
|
@bp.errorhandler(HTTPException)
|
|
def generic_error_handler(e):
|
|
if (request.accept_mimetypes.accept_json
|
|
and not request.accept_mimetypes.accept_html):
|
|
return {'errors': {'message': e.description}}, e.code
|
|
return render_template('errors/error.html.j2', error=e), e.code
|