TransientHttpErrorHandler Class

Namespace
Kampute.HttpClient.ErrorHandlers
Assembly
  • Kampute.HttpClient.dll

Definition

Handles HTTP responses with a transient error status code by attempting to back off and retry the request according to a specified or default backoff strategy.
public class TransientHttpErrorHandler : RetryableHttpErrorHandler
Inheritance

Constructors

TransientHttpErrorHandler()

Initializes a new instance of the TransientHttpErrorHandler class with default transient error status codes.
public TransientHttpErrorHandler()

Remarks

The default transient error status codes handled by this instance are:
  • 408Request Timeout
  • 502Bad Gateway
  • 503Service Unavailable
  • 504Gateway Timeout
  • 507Insufficient Storage
  • 509Bandwidth Limit Exceeded

TransientHttpErrorHandler(IEnumerable<HttpStatusCode>)

Initializes a new instance of the TransientHttpErrorHandler class with specified transient error status codes.
public TransientHttpErrorHandler(IEnumerable<HttpStatusCode> statusCodes)

Parameters

statusCodes IEnumerable<HttpStatusCode>
The collection of HTTP status codes that this handler will process as transient errors.

Exceptions

ArgumentNullException
Thrown if statusCodes is null.
ArgumentException
Thrown if statusCodes is empty.

Properties

HandledStatusCodes

Gets the collection of HTTP status codes that are considered transient errors and handled by this instance.
public IReadOnlyCollection<HttpStatusCode> HandledStatusCodes { get; }

Property Value

IReadOnlyCollection<HttpStatusCode>
A read-only collection of HttpStatusCode values that are treated as transient errors.

Methods

CanHandle(HttpStatusCode)

Determines whether this handler can process the specified HTTP status code.
public sealed override bool CanHandle(HttpStatusCode statusCode)

Parameters

statusCode HttpStatusCode
The HTTP status code to evaluate.

Returns

bool
true if the handler can process the status code; otherwise, false.

See Also