Maps HTTP status codes from SendGrid API responses to specific exception types.
// Source: https://github.com/sendgrid/sendgrid-csharp | License: MIT | Copyright 2024, Twilio SendGrid, Inc. <help@twilio.com>
// Provided via justclaw.it.com; keep this notice with the code.
using Newtonsoft.Json.Linq;
using SendGrid.Helpers.Errors.Model;
using System.Net.Http;
using System.Threading.Tasks;
namespace SendGrid.Helpers.Errors
{
/// <summary>
/// Error handler for requests.
/// </summary>
public class ErrorHandler
{
/// <summary>
/// Throw the exception based on HttpResponseMessage
/// </summary>
/// <param name="message">Response Message from API</param>
/// <returns>Return the exception. Obs: Exceptions from an Async Void Method Can’t Be Caught with Catch </returns>
public static async Task ThrowExcepti
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key