Last active
June 28, 2018 09:55
-
-
Save rmlopes/6f1d668e8f45532407d37ee3744d96f2 to your computer and use it in GitHub Desktop.
An example of using flask abort to raise internal server errors with pyEve
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# In case of an internal server error, flask abort will send an html reponse, which is not in line with a REST API. | |
# _handle_internal_error returns the typical pyEve json error response: | |
def _handle_internal_error(message, code=500): | |
abort(make_response( | |
jsonify(_status = "ERR", | |
_error = {'code':code, 'message':message}), | |
code)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment