Return a useful message if the domain is a duplicate.

This commit is contained in:
Rebecca Law
2019-04-10 13:23:34 +01:00
parent 193ff8548c
commit f35960c3a3
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