Created
August 17, 2013 15:55
-
-
Save niklaskorz/6257571 to your computer and use it in GitHub Desktop.
There has to be a better way, right?
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.errorhandler(400) | |
@app.errorhandler(401) | |
@app.errorhandler(402) | |
@app.errorhandler(403) | |
@app.errorhandler(404) | |
@app.errorhandler(405) | |
@app.errorhandler(406) | |
@app.errorhandler(407) | |
@app.errorhandler(408) | |
@app.errorhandler(409) | |
@app.errorhandler(410) | |
@app.errorhandler(411) | |
@app.errorhandler(412) | |
@app.errorhandler(413) | |
@app.errorhandler(414) | |
@app.errorhandler(415) | |
@app.errorhandler(416) | |
@app.errorhandler(417) | |
@app.errorhandler(500) | |
@app.errorhandler(501) | |
@app.errorhandler(502) | |
@app.errorhandler(503) | |
@app.errorhandler(504) | |
@app.errorhandler(505) | |
@app.errorhandler(506) | |
@app.errorhandler(507) | |
@app.errorhandler(508) | |
@app.errorhandler(509) | |
@app.errorhandler(510) | |
@app.errorhandler(511) | |
def handle_http_error(error): | |
resp = jsonify(error={ | |
"code": error.code, | |
"description": error.description | |
}) | |
resp.status_code = error.code | |
return resp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment