mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-05 02:41:14 -05:00
Changed db queries to use one, which throws NoResultFound exception, this exception is dealt with in our error handlers.
Now a lot of the if none checks can be removed.
This commit is contained in:
@@ -48,15 +48,15 @@ def register_errors(blueprint):
|
||||
|
||||
@blueprint.app_errorhandler(NoResultFound)
|
||||
def no_result_found(e):
|
||||
current_app.logger.error(e)
|
||||
current_app.logger.error(str(e))
|
||||
return jsonify(result='error', message="No result found"), 404
|
||||
|
||||
@blueprint.app_errorhandler(DataError)
|
||||
def data_error(e):
|
||||
current_app.logger.error(e)
|
||||
current_app.logger.error(str(e))
|
||||
return jsonify(result='error', message="No result found"), 404
|
||||
|
||||
@blueprint.app_errorhandler(SQLAlchemyError)
|
||||
def db_error(e):
|
||||
current_app.logger.error(e)
|
||||
current_app.logger.error(str(e))
|
||||
return jsonify(result='error', message=str(e)), 500
|
||||
|
||||
Reference in New Issue
Block a user