exceptions
This commit is contained in:
parent
765d56ecc7
commit
4ff2a93cb9
1 changed files with 10 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
|||
from flask import Flask, request, redirect, url_for, render_template
|
||||
from app.views import routes
|
||||
from flask import jsonify
|
||||
|
||||
def create_app():
|
||||
# create and configure the app
|
||||
|
@ -7,3 +8,12 @@ def create_app():
|
|||
app.config.from_pyfile('settings.py')
|
||||
app.register_blueprint(routes)
|
||||
return app
|
||||
|
||||
|
||||
@app.errorhandler(403)
|
||||
def not_authorised(e):
|
||||
return jsonify(error="Not authorized"), 403
|
||||
|
||||
@app.errorhandler(500)
|
||||
def internal_server_error(e):
|
||||
return jsonify(error="Internal server error"), 500
|
||||
|
|
Loading…
Reference in a new issue