Commit 6fc121d9 authored by Fence's avatar Fence 🌈

add error handlers

parent 02b910bc
from flask import Flask
from minor.controller import ApiController, MusicController
from minor.error_handlers import set_error_handlers
class App(object):
def __init__(self, config):
self._flask = Flask(__name__)
self._flask.config['MONGODB_SETTINGS'] = {'db': 'minor'}
from minor.model import db
from flask import jsonify
def set_error_handlers(app):
def four_o_four(e):
return jsonify({"code": 404, "msg": "not found"}), 404
def five_hundred(e):
return jsonify({"code": 500, "msg": "internal error"}), 500
def verboten(e):
return jsonify({"code": 403, "msg": "verboten"}), 403
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