Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
523 B
0
Indexable
Never
private static HttpRequestException CreateResponseException(HttpResponseMessage response, string responseContent)
{
    switch (response.StatusCode)
    {
        case HttpStatusCode.InternalServerError:
            var problemDetails = JsonSerializer.Deserialize<ProblemDetails>(responseContent);
            return new HttpRequestException(problemDetails.Title, null, response.StatusCode);

        default:
            return new HttpRequestException(response.ReasonPhrase, null, response.StatusCode);
    }
}
Leave a Comment