Stop logging email addresses for SES errors

We shouldn't be logging PII so we should not log email addresses. We
remove the email address and just log the normal exception message.

Note, this meant before that you could see the email address and more
easily track down the notification ID in the database. Now instead, you
will need to search in the DB for notifications that have gone into
technical failure at the time of the log message (as we still don't
log the notification ID alongside the failure).
This commit is contained in:
David McDonald
2020-12-30 17:03:17 +00:00
parent 6a95925897
commit 2079202160
2 changed files with 1 additions and 5 deletions

View File

@@ -122,10 +122,7 @@ class AwsSesClient(EmailClient):
# http://docs.aws.amazon.com/ses/latest/DeveloperGuide/api-error-codes.html
if e.response['Error']['Code'] == 'InvalidParameterValue':
raise InvalidEmailError('email: "{}" message: "{}"'.format(
to_addresses[0],
e.response['Error']['Message']
))
raise InvalidEmailError(str(e))
elif (
e.response['Error']['Code'] == 'Throttling'
and e.response['Error']['Message'] == 'Maximum sending rate exceeded.'

View File

@@ -113,7 +113,6 @@ def test_send_email_raises_bad_email_as_InvalidEmailError(mocker):
)
assert 'some error message from amazon' in str(excinfo.value)
assert 'definitely@invalid_email.com' in str(excinfo.value)
def test_send_email_raises_send_rate_throttling_as_AwsSesClientThrottlingSendRateException(mocker):