Repository navigation
fix!: preserve detail from upstream address parse errors - #1138
Arowolokehinde wants to merge 1 commit into
Conversation
7af33d1 to
d6acb92
Compare
d6acb92 to
8636ba7
Compare
|
The error propagation itself looks correct, and I verified the generated Swift/Kotlin API impact. One question before ACKing: since these unit variants become data-carrying variants, this is a real generated-binding API break. With master currently on 3.2.0-alpha.0 and #1036 tracking breaking changes for 4.0, is this intended to land in 3.2 or should it be tracked for 4.0? |
|
Thank you for the review @j-kon |
muawiya1
left a comment
There was a problem hiding this comment.
tACK 8636ba7
Tested locally. cargo test --lib address_parse and cargo clippy both pass. I also tried parsing a few invalid addresses through the FFI. The error now includes the reason parsing failed. For example, when I passed an address with a bad Base58 checksum it gives base58 address encoding error: incorrect checksum: base58 checksum 0x6c7615f4 does not match expected 0x6b7615f4.
Description
Fixes #1095
AddressParseErrordiscarded the upstream error in seven of ten arms, reporting only a generic label such as"base58 address encoding error". Every variant now carries anerror_messageholding the upstream detail:Notes to the reviewers
Why the conversion follows each error's
source()instead of relying onto_string()alone.The detail sits two levels below
ParseError::Base58. The wrapping errors use thewrite_err!macro, which leaves the source out ofDisplaywhen thestdfeature is enabled — soto_string()returns"base58 error"and nothing else, and the rest is reachable only throughsource().Scope. The issue names Base58, Bech32 and network validation. This also covers the four other arms that discard the error the same way, plus
OtherAddressParseErr, which had no payload at all. The change breaks the generated bindings either way. Happy to narrow it to the three named variants if you'd prefer.Documentation
bitcoinbitcoin::address::ParseErrorChangelog
changelog: breakingChecklists
All Submissions:
cargo fmtandcargo clippybefore committingchangelog:*labelBugfixes: