mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-31 23:26:23 -05:00
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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user