mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 18:31:13 -05:00
Add DAO function and endpoint for archiving email reply_to addresses
Added a new DAO function which archives email reply_to addresses by setting archived to True. This raises a new type of error, an ArchiveValidationError, if trying to archive a default reply_to address. Added a new endpoint for archiving email reply_to addresses.
This commit is contained in:
@@ -8,6 +8,7 @@ from sqlalchemy.orm.exc import NoResultFound
|
||||
from marshmallow import ValidationError
|
||||
from jsonschema import ValidationError as JsonSchemaValidationError
|
||||
from app.authentication.auth import AuthError
|
||||
from app.exceptions import ArchiveValidationError
|
||||
|
||||
|
||||
class VirusScanError(Exception):
|
||||
@@ -67,6 +68,11 @@ def register_errors(blueprint):
|
||||
current_app.logger.info(error)
|
||||
return jsonify(json.loads(error.message)), 400
|
||||
|
||||
@blueprint.errorhandler(ArchiveValidationError)
|
||||
def archive_validation_error(error):
|
||||
current_app.logger.info(error)
|
||||
return jsonify(result='error', message=str(error)), 400
|
||||
|
||||
@blueprint.errorhandler(InvalidRequest)
|
||||
def invalid_data(error):
|
||||
response = jsonify(error.to_dict())
|
||||
|
||||
Reference in New Issue
Block a user