Struct HttpErrorHandlerResult
- Namespace
- Kampute.HttpClient
- Assembly
- Kampute.HttpClient.dll
Represents the outcome of an HTTP error handling attempt by a specific handler, indicating whether it determines a failed request should be retried.
public readonly struct HttpErrorHandlerResult
- Inherited Members
Remarks
This struct communicates the decision of an HTTP error handler regarding the handling of a failed request. It specifies whether the handler determines the request should be retried, potentially with modifications, or if it considers the error not recoverable by its logic, indicating that a retry should not be attempted. This determination is contextual to the handler's implementation and does not preclude other handlers from potentially retrying the request.
Fields
NoRetry
Represents a result indicating that the request should not be retried according to the handler's determination.
public static readonly HttpErrorHandlerResult NoRetry
Field Value
RequestToRetry
Gets the HttpRequestMessage to use for retrying the failed request, if the handler determines a retry is warranted; otherwise, null.
public readonly HttpRequestMessage? RequestToRetry
Field Value
- HttpRequestMessage
The HttpRequestMessage to use for retrying the failed request, if the handler determines a retry is warranted; otherwise, null.
Methods
Retry(HttpRequestMessage)
Creates a result indicating that the request should be retried with the provided HttpRequestMessage.
public static HttpErrorHandlerResult Retry(HttpRequestMessage requestToRetry)
Parameters
requestToRetry
HttpRequestMessageThe request to use for the retry.
Returns
- HttpErrorHandlerResult
An HttpErrorHandlerResult indicating the request should be retried with the provided HttpRequestMessage.
Exceptions
- ArgumentNullException
Thrown if
requestToRetry
is null.