We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
withErrorCancellable
/// Error handler for decoding fetch responses into an user defined error type. Will ignore successful responses. let withErrorCancellable (errorHandler: HttpResponse -> HttpContent -> CancellationToken -> Task<exn>) (source: HttpHandler<HttpContent>) : HttpHandler<HttpContent> = fun next -> { new IHttpNext<HttpContent> with member _.OnSuccessAsync(ctx, content) = task { let response = ctx.Response match response.IsSuccessStatusCode with | true -> return! next.OnSuccessAsync(ctx, content) | false -> ctx.Request.Metrics.Counter Metric.FetchErrorInc ctx.Request.Labels 1L let! err = errorHandler response content ctx.Request.CancellationToken return! next.OnErrorAsync(ctx, HttpException(ctx, err)) } member _.OnErrorAsync(ctx, exn) = next.OnErrorAsync(ctx, exn) member _.OnCancelAsync(ctx) = next.OnCancelAsync(ctx) } |> source
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: