Merge pull request #3362 from alphagov/fix-message-too-long-error

Fix the error message for message-too-long
This commit is contained in:
Rebecca Law
2020-03-10 13:07:13 +00:00
committed by GitHub
3 changed files with 11 additions and 14 deletions

View File

@@ -907,8 +907,11 @@ def get_template_error_dict(exception):
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'
# the error from the api is changing for message-too-long, but we need both until the api is deployed.
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'
elif 'Text messages cannot be longer than' in exception.message:
error = 'message-too-long'
else: else:
raise exception raise exception

View File

@@ -1,13 +1,7 @@
{% from "components/banner.html" import banner_wrapper %} <h1 class='banner-title'>
Message too long
<div class="bottom-gutter"> </h1>
{% call banner_wrapper(type='dangerous') %} <p>
<h1 class='banner-title'> Text messages cannot be longer than {{ SMS_CHAR_COUNT_LIMIT }} characters.
Message too long Your message is {{ template.content_count }} characters.
</h1> </p>
<p>
Text messages cannot be longer than {{ SMS_CHAR_COUNT_LIMIT }} characters.
Your message is {{ template.content_count }} characters.
</p>
{% endcall %}
</div>

View File

@@ -3560,7 +3560,7 @@ TRIAL_MODE_MSG = (
'Cannot send to this recipient when service is in trial mode ' 'Cannot send to this recipient when service is in trial mode '
'see https://www.notifications.service.gov.uk/trial-mode' 'see https://www.notifications.service.gov.uk/trial-mode'
) )
TOO_LONG_MSG = 'Content for template has a character count greater than the limit of 612' TOO_LONG_MSG = 'Text messages cannot be longer than 612 characters. Your message is 654 characters.'
SERVICE_DAILY_LIMIT_MSG = 'Exceeded send limits (1000) for today' SERVICE_DAILY_LIMIT_MSG = 'Exceeded send limits (1000) for today'