mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-16 10:12:32 -05:00
Give better error when sending to non-team member
Scenario we saw in research: - trying to send a message to someone outside your team - service is in trial mode Result: - error message was terrible, no-one understood it Solution: - better error message
This commit is contained in:
@@ -270,9 +270,13 @@ def send_notification(notification_type):
|
||||
[user.mobile_number, user.email_address] for user in service.users
|
||||
)
|
||||
):
|
||||
message = 'Invalid {} for restricted service'.format(first_column_heading[notification_type])
|
||||
errors = {'to': [message]}
|
||||
raise InvalidRequest(errors, status_code=400)
|
||||
raise InvalidRequest(
|
||||
{'to': [(
|
||||
'Can’t send to this recipient when service is in trial mode '
|
||||
'– see https://www.notifications.service.gov.uk/trial-mode'
|
||||
)]},
|
||||
status_code=400
|
||||
)
|
||||
|
||||
notification_id = create_uuid()
|
||||
notification.update({"template_version": template.version})
|
||||
|
||||
Reference in New Issue
Block a user