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

feat: Provide users possible status codes that SendGrid can return #1155

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

maxkoshevoi
Copy link
Contributor

Fixes

SendGrid specifies exact status codes it could return with their respective meanings, but currently SDK doesn't provide this information to the user.

Added a SendGridStatusCode enum that would make writing code that reacts to specific status codes more readable.

Checklist

  • I acknowledge that all my contributions will be made under the project's license
  • I have made a material change to the repo (functionality, testing, spelling, grammar)
  • I have read the Contribution Guidelines and my PR follows them
  • I have titled the PR appropriately
  • I have updated my branch with the main branch
  • I have added tests that prove my fix is effective or that my feature works
  • I have added the necessary documentation about the functionality in the appropriate .md file
  • I have added inline documentation to the code I modified

If you have questions, please file a support ticket, or create a GitHub Issue in this repository.

@@ -6,9 +6,10 @@
public class SendGridErrorResponse
{
/// <summary>
/// Gets or sets the error Status Code
/// Gets or sets the error Status Code.<br/>
/// Might be any <see cref="System.Net.HttpStatusCode"/>, not just ones in <see cref="SendGridStatusCode"/>.
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens to this property when the value is not defined in SendGridStatusCode? Guessing null and worried that clients would then not get the actual status code. Could this be added as an extra property of SendGridErrorResponse so it's backwards-compatible and supports the benefits of the enum?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

enums are value type, so cannot be null. If value of ErrorHttpStatusCode is not defined in SendGridStatusCode, it will still be stored in ErrorHttpStatusCode (Visual Studio will just show you int value instead of a name).

Admittedly, this might be not the best solution since value of ErrorHttpStatusCode might be outside of what's defined SendGridStatusCode, but no information will be lost.

@maxkoshevoi maxkoshevoi changed the title Provide users possible status codes that SendGrid can return feat: Provide users possible status codes that SendGrid can return Apr 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants