Skip to content

Add public isrecoverable(::Exception) for retry classification (#1245)#1310

Merged
quinnj merged 1 commit into
masterfrom
jq-isrecoverable
Jun 15, 2026
Merged

Add public isrecoverable(::Exception) for retry classification (#1245)#1310
quinnj merged 1 commit into
masterfrom
jq-isrecoverable

Conversation

@quinnj

@quinnj quinnj commented Jun 15, 2026

Copy link
Copy Markdown
Member

Closes #1245.

Downstream packages (notably GitHub.jl, reported by @DilumAluthge / @ericphanson) used HTTP.jl 1.x's HTTP.RetryRequest.isrecoverable(::Exception) to decide whether a request-path exception is worth retrying. The 2.0 rewrite dropped that module, and the equivalent logic survived only in the private _retryable_request_error.

This exposes it as a documented, public HTTP.isrecoverable(::Exception)::Bool that delegates to the same classifier the built-in retry policy uses — same name as the 1.x API to ease migration. It recognizes the transient transport/protocol failures (connection resets/EOF, socket errors, parse errors, dial/TLS-handshake timeouts, and the unwrapped causes of OpError/TLSError), treats a hit request deadline as non-recoverable, and accepts either the raw exception or the RequestRetryError wrapper handed to a retry_if callback.

HTTP.isrecoverable(EOFError())                       # true
HTTP.isrecoverable(ArgumentError("nope"))            # false
HTTP.isrecoverable(HTTP.RequestRetryError(EOFError())) # true — unwraps the retry_if wrapper

Minimal surface: a thin public wrapper over the existing internal function (no logic change, internal call sites untouched), documented in the client API reference, with tests covering recoverable/non-recoverable classification, the wrapper, and parity with the internal classifier.

🤖 Generated with Claude Code

Downstream packages (e.g. GitHub.jl) used HTTP.jl 1.x's private
HTTP.RetryRequest.isrecoverable to decide whether a request exception is
worth retrying. 2.0 dropped that module; the equivalent logic lived only in
the private _retryable_request_error.

Expose it as a documented public HTTP.isrecoverable(::Exception)::Bool that
delegates to the same battle-tested classifier the built-in retry policy
uses. Accepts either the underlying exception or the RequestRetryError
wrapper passed to a retry_if callback, so downstream retry/backoff logic no
longer has to reach into HTTP internals.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@codecov

codecov Bot commented Jun 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.31%. Comparing base (b4b0a5e) to head (fcfd2c0).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1310   +/-   ##
=======================================
  Coverage   87.31%   87.31%           
=======================================
  Files          29       29           
  Lines       11289    11291    +2     
=======================================
+ Hits         9857     9859    +2     
  Misses       1432     1432           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: Public API for HTTP.RetryRequest.isrecoverable(::Exception)

1 participant