Skip to content

SendGridClient.RequestAsync returns 200 OK on any exception #433

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

Closed
benmiller86 opened this issue Apr 11, 2017 · 4 comments
Closed

SendGridClient.RequestAsync returns 200 OK on any exception #433

benmiller86 opened this issue Apr 11, 2017 · 4 comments

Comments

@benmiller86
Copy link

Issue Summary

The SendGridClient.RequestAsync method returns a response with the status code of 200 when any exception is thrown. I ran into this as I wanted to implement retries in the even of transient errors. The easiest of which to create was disconnecting my PC from the internet (or at least the first I thought of). To my surprise I got a 200 OK suggesting nothing had gone wrong. I know that it returns a 202 Accepted when the email is actually sent so I can deal with this, but returning a 200 OK is pretty misleading.

Steps to Reproduce

  1. Disconnect your PC from the internet
  2. Try to send an email using this library
  3. Check the response code (it will be 200 OK)
@ottomatic
Copy link
Contributor

Is this a duplicate of issue #358 which I am working on or is it different functionality (info request vs sending messages)?

@benmiller86
Copy link
Author

It is, my apologies. I scanned through the open issues bit didn't see that one. I'll close this.

@ottomatic
Copy link
Contributor

@benmiller86: It could actually have been separate but similar errors in the code. But in this case one method (SendEmailAsync) calls the other (RequestAsync) so I will fix both by not swallowing the exception inside RequestAsync.

Best regards.

@benmiller86
Copy link
Author

@ottomatic You are quite correct. I am actually consuming the SendEmailAsync method myself, but when I referred to the source code I saw that it was the RequestAsync method that was the issue.

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

No branches or pull requests

2 participants