Commit 24e25564 authored by axiiom's avatar axiiom

woooo no more html responses

parent 39ff002f
from flask import jsonify
def register_error_handlers(app):
def generic_handler(e):
'''
This generic handler will handle any errors registered and will return a JSON
response instead of dumb html lol
'''
response = e.get_response()
data = { "error": e.name, "description": e.description }
return jsonify(data), e.code
app.register_error_handler(400, generic_handler)
app.register_error_handler(404, generic_handler)
app.register_error_handler(500, generic_handler)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment