Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: replacing exceptions #31827

Merged
merged 11 commits into from
May 25, 2023
Merged

fix: replacing exceptions #31827

merged 11 commits into from
May 25, 2023

Conversation

awais786
Copy link
Contributor

@awais786 awais786 commented Feb 24, 2023

For details check this issue

**Removed boto related exceptions. **

edx-app is using latest version of django-ses which uses boto3 for mail sending. So apparently exceptions being in use are not working, these were implemented for boto and in boto3 they have changed all exceptions.

@awais786 awais786 force-pushed the boto-ses.exception-to-boto3 branch 2 times, most recently from 89ad5c7 to f0339ad Compare March 2, 2023 05:14
@@ -444,18 +444,6 @@ def _test_immediate_failure(self, exception):
def test_failure_on_unhandled_smtp(self):
self._test_immediate_failure(SMTPAuthenticationError(403, "That password doesn't work!"))

def test_failure_on_ses_quota_exceeded(self):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Things already working without these exceptions.

@awais786 awais786 marked this pull request as ready for review March 2, 2023 06:46
@awais786 awais786 changed the title fix: fixing test. fix: replacing exceptions Mar 2, 2023
@justinhynes justinhynes self-assigned this Mar 29, 2023
)
subtask_status.increment(failed=1)
if exc.response['Error']['Code'] in [
'InvalidParameterValue', 'MessageRejected', 'MailFromDomainNotVerified'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like InvalidParameterValue may not be an exception that SES recognizes/throws? I'm looking at the list here: https://botocore.amazonaws.com/v1/documentation/api/latest/reference/services/ses.html#client-exceptions. I see MessageRejected and MailFromDomainNotVerified, but not InvalidParameterValue. Should this be included?

Comment on lines -103 to -106
SESAddressNotVerifiedError, # Raised when a "Reply-To" address has not been validated in SES yet.
SESIdentityNotVerifiedError, # Raised when an identity has not been verified in SES yet.
SESDomainNotConfirmedError, # Raised when domain ownership is not confirmed for DKIM.
SESDailyQuotaExceededError, # 24-hour allotment of outbound email has been exceeded.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that we removed a number of these failure exceptions, are there any introduced in botocore/boto3 that we can/should take advantage of?

I was looking to see if the ones we removed mapped to any of the new/currently supported exceptions (here: https://botocore.amazonaws.com/v1/documentation/api/latest/reference/services/ses.html#client-exceptions) and I saw items such as AccountSendingPausedException, MailFromDomainNotVerifiedException, LimitExceededException that seemed similar.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you continue working on this? We have very limited domain knowledge here to replace all those exceptions.

@awais786
Copy link
Contributor Author

@justinhynes any plan for this PR ?. Its blocking us to upgrade django-storages.

@awais786
Copy link
Contributor Author

Since we are catching clienterror at multiple locations so in case of no matching error code raise the exception again.

@awais786
Copy link
Contributor Author

@justinhynes Kindly review this PR. Also I have a question I did't find any exception log on splunk for last couple of weeks.
I think its due to the latest django-ses is using boto3 exceptions and these current exceptions are not functional. This is my assumption :)

@UsamaSadiq UsamaSadiq merged commit fcb4c4d into master May 25, 2023
@UsamaSadiq UsamaSadiq deleted the boto-ses.exception-to-boto3 branch May 25, 2023 12:45
UsamaSadiq added a commit that referenced this pull request May 25, 2023
@edx-pipeline-bot
Copy link
Contributor

EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

EdX Release Notice: This PR has been deployed to the production environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants