Adds a POST version of get inbound messages by phone number. Allows us to POST the search so the phone number is hidden

This commit is contained in:
Martyn Inglis
2017-06-09 10:34:02 +01:00
parent 03c6e74c46
commit 7dccf796dd
4 changed files with 196 additions and 14 deletions

View File

@@ -1,10 +1,11 @@
from flask import (
jsonify,
current_app
)
current_app,
json)
from sqlalchemy.exc import SQLAlchemyError, DataError
from sqlalchemy.orm.exc import NoResultFound
from marshmallow import ValidationError
from jsonschema import ValidationError as JsonSchemaValidationError
from app.authentication.auth import AuthError
from app.notifications import SendNotificationToQueueError
@@ -50,6 +51,11 @@ def register_errors(blueprint):
current_app.logger.error(error)
return jsonify(result='error', message=error.messages), 400
@blueprint.errorhandler(JsonSchemaValidationError)
def validation_error(error):
current_app.logger.exception(error)
return jsonify(json.loads(error.message)), 400
@blueprint.errorhandler(InvalidRequest)
def invalid_data(error):
response = jsonify(error.to_dict())