Wire up error handlers.

Replace some 400s with more appropriate 500s.

DAO methods that cause unexpected exceptions get caught and
logged by errors.py 500 error handler.
This commit is contained in:
Adam Shimali
2016-02-17 17:04:50 +00:00
parent b98d8b9996
commit 4f33b6f406
7 changed files with 66 additions and 55 deletions

View File

@@ -1,5 +1,8 @@
from flask import Blueprint
from flask import (jsonify)
from flask import (
Blueprint,
jsonify
)
from sqlalchemy.exc import DataError
from sqlalchemy.orm.exc import NoResultFound
@@ -8,6 +11,9 @@ from app.schemas import (template_schema, templates_schema)
template = Blueprint('template', __name__)
from app.errors import register_errors
register_errors(template)
# I am going to keep these for admin like operations
# Permissions should restrict who can access this endpoint