Table of Contents

Class DefaultErrorHandler

Namespace
TypedRest.Errors
Assembly
TypedRest.dll

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

public class DefaultErrorHandler : IErrorHandler
Inheritance
DefaultErrorHandler
Implements
Inherited Members

Methods

HandleAsync(HttpResponseMessage)

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

public Task HandleAsync(HttpResponseMessage response)

Parameters

response HttpResponseMessage

Returns

Task

Exceptions

InvalidDataException

BadRequest

AuthenticationException

Unauthorized

UnauthorizedAccessException

Forbidden

KeyNotFoundException

NotFound or Gone

InvalidOperationException

Conflict, PreconditionFailed or RequestedRangeNotSatisfiable

HttpRequestException

Other non-success status code.