TypedRest for .NET 1.3.6
build type-safe fluent-style REST API clients
TypedRest.Errors.DefaultErrorHandler Class Reference

Handles errors in HTTP responses by mapping status codes to common exception types. More...

Inheritance diagram for TypedRest.Errors.DefaultErrorHandler:
TypedRest.Errors.IErrorHandler

Public Member Functions

async Task HandleAsync (HttpResponseMessage response)
 Throws appropriate Exceptions based on HTTP status codes and response bodies. More...
 

Detailed Description

Handles errors in HTTP responses by mapping status codes to common exception types.

Member Function Documentation

◆ HandleAsync()

async Task TypedRest.Errors.DefaultErrorHandler.HandleAsync ( HttpResponseMessage  response)
inline

Throws appropriate Exceptions based on HTTP status codes and response bodies.

Exceptions
InvalidDataExceptionHttpStatusCode.BadRequest
AuthenticationExceptionHttpStatusCode.Unauthorized
UnauthorizedAccessExceptionHttpStatusCode.Forbidden
KeyNotFoundExceptionHttpStatusCode.NotFound or HttpStatusCode.Gone
InvalidOperationExceptionHttpStatusCode.Conflict, HttpStatusCode.PreconditionFailed or HttpStatusCode.RequestedRangeNotSatisfiable
HttpRequestExceptionOther non-success status code.

Implements TypedRest.Errors.IErrorHandler.


The documentation for this class was generated from the following file: