feat: Provide users possible status codes that SendGrid can return#1155
feat: Provide users possible status codes that SendGrid can return#1155maxkoshevoi wants to merge 5 commits intosendgrid:mainfrom
Conversation
| /// <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"/>. |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
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
SendGridStatusCodeenum that would make writing code that reacts to specific status codes more readable.Checklist
If you have questions, please file a support ticket, or create a GitHub Issue in this repository.