Merge pull request #2453 from alphagov/update-response-for-duplicate-domains

Return a useful message if the domain is a duplicate.
This commit is contained in:
Rebecca Law
2019-04-12 09:44:29 +01:00
committed by GitHub
2 changed files with 19 additions and 0 deletions

View File

@@ -34,6 +34,9 @@ def handle_integrity_error(exc):
if 'ix_organisation_name' in str(exc):
return jsonify(result="error",
message="Organisation name already exists"), 400
if 'domain_organisation_id_fkey' in str(exc):
return jsonify(result='error',
message='Domain already exists'), 400
current_app.logger.exception(exc)
return jsonify(result='error', message="Internal server error"), 500