Skip to content

Instantly share code, notes, and snippets.

@simplyluke
Last active March 19, 2018 16:26
Show Gist options
  • Save simplyluke/1e7e2b386cfef1ef5a026451b7efc38c to your computer and use it in GitHub Desktop.
Save simplyluke/1e7e2b386cfef1ef5a026451b7efc38c to your computer and use it in GitHub Desktop.
flask json errors
# 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