Skip to content

refactor!: mark public error enums as non-exhaustive - #666

Open
reez wants to merge 1 commit into
bitcoindevkit:masterfrom
reez:error-policy
Open

reez wants to merge 1 commit into
bitcoindevkit:masterfrom
reez:error-policy

Conversation

@reez

@reez reez commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Description

Closes #665.

Marks 14 public error enums #[non_exhaustive] and documents the convention in CONTRIBUTING.md. #628 handles CreateTxError separately.

This is a breaking change for downstream callers that match these enums exhaustively.

Before submitting

@reez reez added this to the Wallet 4.0.0-alpha.0 milestone Nov 30, 2026
@reez reez self-assigned this Nov 30, 2026
@reez
reez requested a review from a team as a code owner November 30, 2026 18:26
@reez reez added the api A breaking API change label Nov 30, 2026
@github-project-automation github-project-automation Bot moved this to Triage in BDK Wallet Nov 30, 2026
@reez reez moved this from Triage to Needs Review in BDK Wallet Nov 30, 2026
@codecov

codecov Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.08%. Comparing base (f6f45f4) to head (3e641c7).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #666      +/-   ##
==========================================
+ Coverage   82.04%   82.08%   +0.03%     
==========================================
  Files          25       25              
  Lines        6310     6307       -3     
  Branches      308      308              
==========================================
  Hits         5177     5177              
+ Misses       1030     1027       -3     
  Partials      103      103              
Flag Coverage Δ
rust 82.08% <ø> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@muhahahmad68

Copy link
Copy Markdown
Contributor

tACK 55e59f5

Went through the diff and ran cargo test --workspace --all-features . All passes.

#[non-exhaustive] on the enum covers new variants, but struct variants like LoadMismatch::Descriptor { .. } could still gain fields later, which would break anyone restructuring them. Is leaving those out intentional, or would it be worth marking them too while we're already making a breaking change?

Nit: the "rust-bitcoin’s" in CONTRIBUTING.md has a curly apostrophe, unlike the rest of the file.

@reez

reez commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

tACK 55e59f5

Went through the diff and ran cargo test --workspace --all-features . All passes.

#[non-exhaustive] on the enum covers new variants, but struct variants like LoadMismatch::Descriptor { .. } could still gain fields later, which would break anyone restructuring them. Is leaving those out intentional, or would it be worth marking them too while we're already making a breaking change?

Nit: the "rust-bitcoin’s" in CONTRIBUTING.md has a curly apostrophe, unlike the rest of the file.

Thanks for the tACK!

Leaving the struct variants was intentional since 665 is about letting us add new error variants, also I fixed the apostrophe.

Thanks for the review

@noahjoeris noahjoeris left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ACK 3e641c7

Thanks for adding this! I like it.

This branch has not been deployed

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

Labels

api A breaking API change

Projects

Status: Needs Review

Development

Successfully merging this pull request may close these issues.

Adopt #[non_exhaustive] as the default for public error enums

3 participants