Reduce logging level

If the organisation name that is being inserted or updated is not unique we just want to return a 400 to the admin app.
Updated the code so that we are not logging.exception, this is because a cloud watch alert is set to the support team. This type of error is not something we need to investigate.
This commit is contained in:
Rebecca Law
2018-02-14 14:35:40 +00:00
parent 15c2a9461e
commit 6f488bf7c7
2 changed files with 20 additions and 19 deletions

View File

@@ -1,4 +1,4 @@
from flask import Blueprint, current_app, jsonify, request
from flask import Blueprint, jsonify, request
from sqlalchemy.exc import IntegrityError
from app.dao.organisation_dao import (
@@ -29,11 +29,7 @@ def handle_integrity_error(exc):
Handle integrity errors caused by the unique contraint on ix_organisation_name
"""
if 'ix_organisation_name' in str(exc):
current_app.logger.exception('Unique constraint ix_organisation_name triggered')
return jsonify(
result='error',
message='Organisation name already exists'
), 400
raise InvalidRequest('Organisation name already exists', 400)
raise