Skip to content

Restore HTTP.Exceptions as a deprecating compat shim + migration note#1315

Merged
quinnj merged 1 commit into
JuliaWeb:masterfrom
mathieu17g:fix/exceptions-submodule-shim
Jun 23, 2026
Merged

Restore HTTP.Exceptions as a deprecating compat shim + migration note#1315
quinnj merged 1 commit into
JuliaWeb:masterfrom
mathieu17g:fix/exceptions-submodule-shim

Conversation

@mathieu17g

Copy link
Copy Markdown
Contributor

Implements the deprecating HTTP.Exceptions shim and migration note discussed in #1314 (context and prevalence there).

src/HTTP.jl re-adds HTTP.Exceptions as a thin deprecated submodule forwarding the four relocated types to their top-level names:

module Exceptions
    import ..HTTP
    Base.@deprecate_binding HTTPError    HTTP.HTTPError    false
    Base.@deprecate_binding StatusError  HTTP.StatusError  false
    Base.@deprecate_binding ConnectError HTTP.ConnectError false
    Base.@deprecate_binding TimeoutError HTTP.TimeoutError false
end

So catch … isa HTTP.Exceptions.StatusError resolves again, forwarding to HTTP.StatusError with a --depwarn=yes warning — same mechanism as the existing @deprecate escape escapeuri, and like it, untested.

RequestError, @try, and current_exceptions_to_string are not reinstated; the migration note covers them (RequestError has no drop-in — the underlying exception propagates and isrecoverable classifies it, #1310).

docs/src/guides/migration-1x.md gains an "Exceptions" section (Before/After for StatusError and RequestError) and a Final-Checklist line.

Closes #1314.

Re-add HTTP.Exceptions as a thin deprecated submodule forwarding HTTPError,
StatusError, ConnectError and TimeoutError to the canonical top-level names via
Base.@deprecate_binding (as the existing escape -> escapeuri), so downstream
`catch ... isa HTTP.Exceptions.StatusError` keeps working with a deprecation
warning. RequestError, @Try and current_exceptions_to_string are not reinstated;
the migration guide documents them (RequestError has no drop-in -- the underlying
exception propagates and isrecoverable classifies it).

Closes JuliaWeb#1314.
@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.17%. Comparing base (9e830d9) to head (2e44ce5).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1315      +/-   ##
==========================================
- Coverage   87.32%   87.17%   -0.16%     
==========================================
  Files          29       29              
  Lines       11326    11326              
==========================================
- Hits         9890     9873      -17     
- Misses       1436     1453      +17     

☔ 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.

@mathieu17g

Copy link
Copy Markdown
Contributor Author

The codecov/project -0.16% is an indirect drop in http2_server.jl's non-deterministic error/RST paths (base 10 coverage sessions vs this PR's 5; codecov/patch green; this PR's files untracked) — a re-run should re-aggregate and clear it.

@quinnj quinnj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM; thanks!

@quinnj quinnj merged commit a1eb82b into JuliaWeb:master Jun 23, 2026
7 of 8 checks passed
krynju added a commit to krynju/AWS.jl that referenced this pull request Jun 25, 2026
`_HTTP_V2 = !isdefined(HTTP, :Exceptions)` is no longer reliable: HTTP 2.x
re-adds `HTTP.Exceptions` as a deprecating compat shim (JuliaWeb/HTTP.jl#1315),
so on a 2.x release carrying that shim the flag would flip to `false` and AWS.jl
would silently run its 1.x code paths on HTTP 2. Switch to `pkgversion(HTTP) >= 2`
(with an `HTTP.EmptyBody` feature-detection fallback for Julia < 1.9 — a genuine
2.x-only type that is not shimmed back).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
krynju added a commit to krynju/AWSS3.jl that referenced this pull request Jun 25, 2026
The `isdir` test picked the `StatusError` constructor via
`isdefined(AWS.HTTP, :Exceptions)`. HTTP 2.x re-adds `HTTP.Exceptions` as a
deprecating compat shim (JuliaWeb/HTTP.jl#1315), so on such a release the test
would take the 1.x branch and call the removed 4-arg
`StatusError(status, method, target, response)` constructor → MethodError.
Key off `HTTP.EmptyBody` (a genuine 2.x-only type that is not shimmed) instead.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
krynju added a commit to JuliaComputing/GitForge.jl that referenced this pull request Jun 25, 2026
`_HTTP_V2 = !isdefined(HTTP, :Header)` keys off a removed binding's absence,
which is fragile: HTTP.jl 2.x has re-added other removed bindings as deprecating
shims (e.g. HTTP.Exceptions, JuliaWeb/HTTP.jl#1315), so a future Header shim
would silently flip the flag. Use `pkgversion(HTTP) >= 2`, falling back to a
genuine 2.x-only type (`HTTP.EmptyBody`) when pkgversion is unavailable
(Julia < 1.9).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
nkottary added a commit to JuliaWeb/GitForge.jl that referenced this pull request Jun 29, 2026
* Update HTTP.jl to 2.4.0

* Fix compatibility with HTTP.jl 2.x API

- Replace HTTP.Header[] with Pair{String,String}[]; the HTTP.Header
  type alias was removed from the public API in HTTP.jl 2.0.
- Replace HTTP.StatusError(status, method, url, resp) with
  HTTP.StatusError(resp); the v2 StatusError struct has only
  (status, response) fields and no longer takes method/url arguments.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Fix remaining HTTP.jl 2.x test failures

Replace HTTP.Header[] with Pair{String,String}[] since HTTP.Header was
removed in HTTP.jl 2.x. Drop the !isempty(out) verbose log assertion
since HTTP.jl 2.x prints verbose output directly to stdout rather than
through Julia's logging system, making it uncapturable by TestLogger.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Drop Julia 1.6 support

HTTP.jl 2.x requires Julia 1.7+, so Julia 1.6 can no longer resolve
the dependency. Remove 1.6 from the CI matrix and bump the julia compat
bound to 1.7 accordingly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Remove docs/Manifest.toml from version control

Add it to .gitignore so it is generated fresh during CI via
Pkg.instantiate(), avoiding stale pinned dependencies (e.g. the
TimeZones build failure on current Julia).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Add missing docstrings to docs

19 documented symbols were not referenced in the manual, causing
makedocs to error with :missing_docs. Add them across three areas:
- API endpoints: get_branches, delete_branch, create_repo (owner/repo
  variant), subscribe/unsubscribe_from_pull_request, groups,
  list_issues, list_pipeline_schedules, and all pull request comment
  CRUD functions
- Bitbucket section: Bitbucket module, BitbucketAPI, RenderedPullRequestMarkup
- Internals: constructfield, write(::FieldContext, ...), @forge

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Bump version 0.4.4 -> 0.5.0

Dropping Julia 1.6 support and requiring HTTP.jl 2.x are both breaking
changes for existing users, warranting a minor version bump under
Julia's pre-1.0 conventions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Add dual HTTP.jl 1.x/2.x support; bump version to 0.4.5

Widen HTTP compat from "2.4.0" to "1.10, 2" so the package resolves on
both HTTP 1.x and 2.x. The sole API incompatibility was the HTTP.StatusError
constructor (4-arg in 1.x, 1-arg in 2.x); this is guarded by a module-level
_HTTP_V2 constant derived from isdefined(HTTP, :Header) (works on Julia 1.6+).
Also fixes the pre-existing broken 2-arg HTTP.StatusError call in Bitbucket
pagination and replaces removed HTTP.status/HTTP.body accessor functions with
direct field access (compatible with both versions).

Restore Julia 1.6 to Project.toml compat and CI matrix: HTTP 1.x supports 1.6,
so users on 1.6 will resolve HTTP 1.x and the conditional paths handle the rest.

Version bump 0.5.0 → 0.4.5: dual-version support is additive, not breaking.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* detect HTTP 2.x by package version, not HTTP.Header absence

`_HTTP_V2 = !isdefined(HTTP, :Header)` keys off a removed binding's absence,
which is fragile: HTTP.jl 2.x has re-added other removed bindings as deprecating
shims (e.g. HTTP.Exceptions, JuliaWeb/HTTP.jl#1315), so a future Header shim
would silently flip the flag. Use `pkgversion(HTTP) >= 2`, falling back to a
genuine 2.x-only type (`HTTP.EmptyBody`) when pkgversion is unavailable
(Julia < 1.9).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* refactor: detect HTTP 2.x era via binding-owned VERSION

`HTTP.VERSION` only exists from HTTP.jl 2.0 on; under 1.x it resolves to the `VERSION` re-exported from `Base` (the Julia version). Guard with `Base.binding_module` before comparing, and bound to the 2.x line (`v"2" <= VERSION < v"3"`) so a future HTTP 3 isn't treated as 2.x. Replaces the prior version-detection.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* Fix http compat

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: krynju <krystian.gulinski@juliahub.com>
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.

HTTP.Exceptions submodule removed in 2.x — restore as a (deprecating) compat shim, or document it?

2 participants