mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-04 12:38:26 -04:00
More Python client weirdness
There’s some weird interaction between the message attribute of the exception and mocking. Luckily there is an internal attribute – `_message` which doesn’t go through all the magic.
This commit is contained in:
@@ -668,11 +668,11 @@ def _check_notification(service_id, template_id, exception=None):
|
|||||||
|
|
||||||
def get_template_error_dict(exception):
|
def get_template_error_dict(exception):
|
||||||
# TODO: Make API return some computer-friendly identifier as well as the end user error messages
|
# 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'
|
error = 'not-allowed-to-send-to'
|
||||||
elif 'Exceeded send limits' in exception.message:
|
elif 'Exceeded send limits' in exception._message:
|
||||||
error = 'too-many-messages'
|
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'
|
error = 'message-too-long'
|
||||||
else:
|
else:
|
||||||
raise exception
|
raise exception
|
||||||
|
|||||||
Reference in New Issue
Block a user