Last active
March 19, 2018 16:26
-
-
Save simplyluke/1e7e2b386cfef1ef5a026451b7efc38c to your computer and use it in GitHub Desktop.
flask json errors
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
# App error handling | |
@app.errorhandler(404) | |
def page_not_found(e): | |
return jsonify(error=404, text=str(e)), 404 | |
@app.errorhandler(500) | |
def internal_server_error(e): | |
return jsonify(error=500, text=str(e)), 500 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment