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:
Chris Hill-Scott
2016-08-10 15:46:12 +01:00
parent c7f6cdc661
commit 0a429e18b4
2 changed files with 23 additions and 7 deletions

View File

@@ -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': [(
'Cant 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})