mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-30 06:21:50 -05:00
Working tests and provider stats table.
Fix for tests and import error. Added tests and updated for code review comments.
This commit is contained in:
@@ -59,4 +59,11 @@ def register_errors(blueprint):
|
||||
@blueprint.app_errorhandler(SQLAlchemyError)
|
||||
def db_error(e):
|
||||
current_app.logger.exception(e)
|
||||
return jsonify(result='error', message=str(e)), 500
|
||||
if e.orig.pgerror and \
|
||||
('duplicate key value violates unique constraint "services_name_key"' in e.orig.pgerror or
|
||||
'duplicate key value violates unique constraint "services_email_from_key"' in e.orig.pgerror):
|
||||
return jsonify(
|
||||
result='error',
|
||||
message={'name': ["Duplicate service name '{}'".format(e.params.get('name', ''))]}
|
||||
), 400
|
||||
return jsonify(result='error', message="Internal server error"), 500
|
||||
|
||||
Reference in New Issue
Block a user