History

feat: Enable `auto-chain-error` by default.

This way, the behaviour of `gix::Error` is the same as it was before without actually exposing an `Exn` error tree.

Sebastian Thiel committed 9 months ago

Commit 08d79661 parent 00c053c3 files · +12 −3Browse files

Unified · Split

3 files
  1. .github/workflows/ci.yml +3 −1
  2. gix/Cargo.toml +8 −2
  3. justfile +1 −0
.github/workflows/ci.yml+3−1
@@ -280,8 +280,10 @@ jobs: · 279 unmodified lines
280280 # due to being more in line with some Unix-oriented assumptions. So we need to verify that
281281 # the test suite is compatible with being run even outside that environment, including that
282282 # `gix-testtools` is still able to run fixture scripts with the `bash` shell as intended.
283+ # `gix-error` is excluded because it gets compiled with the wrong feature toggles here.
284+ # It's tested individually.
283285 run: | # zizmor: ignore[template-injection]
284− cargo nextest run --workspace --no-fail-fast -- ${{ matrix.test-args }}
286+ cargo nextest run --workspace --no-fail-fast --exclude gix-error -- ${{ matrix.test-args }}
285287 - name: Check that tracked archives are up to date
286288 run: |
287289 # If this fails, the fix is usually to commit a regenerated archive.
gix/Cargo.toml+8−2
@@ -24,7 +24,7 @@ required-features = ["blocking-network-client"] · 23 unmodified lines
2424
2525 [features]
2626
27−default = ["max-performance-safe", "comfort", "basic", "extras"]
27+default = ["max-performance-safe", "comfort", "basic", "extras", "auto-chain-error"]
2828
2929 #! There are various categories of features which help to optimize performance and build times. `gix` comes with 'batteries included' and everything is
3030 #! enabled as long as it doesn't sacrifice compatibility. Most users will be fine with that but will pay with higher compile times than necessary as they
@@ -272,6 +272,12 @@ zlib-stock = ["gix-features/zlib"] · 241 unmodified lines
272272 #!
273273 #! The catch-all of feature toggles.
274274
275+## All [`gix::Error`](crate::Error) will produce error chains, which makes them work as expected in conjunction with `anyhow`.
276+auto-chain-error = ["gix-error/auto-chain-error"]
277+
278+## The opposite of `auto-chain-error`. Use it to override `auto-chain-error`.
279+tree-error = ["gix-error/tree-error"]
280+
275281 ## Enable tracing using the `tracing` crate for coarse tracing.
276282 tracing = ["gix-features/tracing"]
277283
@@ -407,7 +413,7 @@ document-features = { version = "0.2.0", optional = true } · 129 unmodified lines
407413 [dev-dependencies]
408414 # For additional features that aren't enabled by default due to MSRV
409415 gix = { path = ".", default-features = false, features = [
410− "need-more-recent-msrv",
416+ "need-more-recent-msrv", "tree-error"
411417 ] }
412418 pretty_assertions = "1.4.0"
413419 gix-testtools = { path = "../tests/tools" }
justfile+1−0
@@ -158,6 +158,7 @@ unit-tests: · 157 unmodified lines
158158 cargo nextest run -p gix-worktree-state-tests --features gix-features-parallel --no-fail-fast
159159 cargo nextest run -p gix-worktree-tests --features gix-features-parallel --no-fail-fast
160160 cargo nextest run -p gix-error --no-fail-fast --test auto-chain-error --features auto-chain-error
161+ cargo nextest run -p gix-error --no-fail-fast
161162 cargo nextest run -p gix-hash --no-fail-fast
162163 cargo nextest run -p gix-hash --features sha256 --no-fail-fast
163164 cargo nextest run -p gix-hash --no-default-features --features sha256 --no-fail-fast # TODO: make this actually work by removing 'sha1' from default features.