Fix error messages on one off sending

This was causing a 500 in production.

This commit:
- reverts the code the working state it was before 68a1426e58
- figures out a way to make the tests pass without breaking the actual
  app
- confirms that mocking things is hard
This commit is contained in:
Chris Hill-Scott
2017-07-27 16:28:49 +01:00
parent a60b3b4bc2
commit 5c9572805e
2 changed files with 13 additions and 5 deletions

View File

@@ -668,11 +668,11 @@ def _check_notification(service_id, template_id, exception=None):
def get_template_error_dict(exception):
# TODO: Make API return some computer-friendly identifier as well as the end user error messages
if 'service is in trial mode' in exception._message:
if 'service is in trial mode' in exception.message:
error = 'not-allowed-to-send-to'
elif 'Exceeded send limits' in exception._message:
elif 'Exceeded send limits' in exception.message:
error = 'too-many-messages'
elif 'Content for template has a character count greater than the limit of' in exception._message:
elif 'Content for template has a character count greater than the limit of' in exception.message:
error = 'message-too-long'
else:
raise exception