mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-15 01:32:20 -05:00
Add validation to check that sms recipient is not None
Previously, if the SMS recipient was None there would be a 500 error with no message displayed to the user. We now check if the recipient is None and raise a BadRequestError if this is the case.
This commit is contained in:
@@ -98,6 +98,9 @@ def check_service_can_schedule_notification(permissions, scheduled_for):
|
||||
|
||||
|
||||
def validate_and_format_recipient(send_to, key_type, service, notification_type):
|
||||
if send_to is None:
|
||||
raise BadRequestError(message="Recipient can't be empty")
|
||||
|
||||
service_can_send_to_recipient(send_to, key_type, service)
|
||||
|
||||
if notification_type == SMS_TYPE:
|
||||
|
||||
Reference in New Issue
Block a user