mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-20 23:41:17 -05:00
fix constraint name check in service error handler
This commit is contained in:
@@ -118,7 +118,10 @@ def handle_integrity_error(exc):
|
|||||||
"""
|
"""
|
||||||
Handle integrity errors caused by the unique constraint on ix_organisation_name
|
Handle integrity errors caused by the unique constraint on ix_organisation_name
|
||||||
"""
|
"""
|
||||||
if 'services_name_key' or 'services_email_from_key' in str(exc):
|
if any(
|
||||||
|
'duplicate key value violates unique constraint "{}"'.format(constraint) in str(exc)
|
||||||
|
for constraint in {'services_name_key', 'services_email_from_key'}
|
||||||
|
):
|
||||||
return jsonify(
|
return jsonify(
|
||||||
result='error',
|
result='error',
|
||||||
message={'name': ["Duplicate service name '{}'".format(
|
message={'name': ["Duplicate service name '{}'".format(
|
||||||
|
|||||||
Reference in New Issue
Block a user