예제 #1
0
def handle_all_errors(error):
    try:
        response = JSON(error=error.to_dict().get('__all__'))
    except Exception:
        response = JSON(error=str(error))

    response.status_code = 500
    return response
예제 #2
0
def page_not_found(error):
    response = JSON(error=str(app.config['ERRORS']['404']))
    response.status_code = 404
    return response
예제 #3
0
def unauthorized(error):
    response = JSON(error=str(app.config['ERRORS']['401']))
    response.status_code = 401
    return response
예제 #4
0
def bad_request(error):
    response = JSON(error=str(app.config['ERRORS']['400']))
    response.status_code = 400
    return response
예제 #5
0
def service_unavailable_error(error):
    response = JSON(error=str(app.config['ERRORS']['503']))
    response.status_code = 503
    return response
예제 #6
0
def internal_server_error(error):
    response = JSON(error=str(app.config['ERRORS']['500']))
    response.status_code = 500
    return response
예제 #7
0
def handle_invalid_request(error):
    response = JSON(error.to_dict())
    response.status_code = error.status_code
    return response