Skip to content

Commit

Permalink
In #945fcd09 we forgot to Update impl for ParsePublicKeyError Display…
Browse files Browse the repository at this point in the history
… and Error traits

WHAT:
- Updated `InvalidChar` in `fmt::Display` to use `write_err!` instead of `write!`, ensuring inner error details are correctly formatted.
- Updated the `fmt::Display` implementation for `ParsePublicKeyError` to handle the inner error type for `InvalidChar`.
The `InvalidChar` variant now utilizes `write_err!` to display the inner error, improving consistency with other error variants.

WHY:
This change enhances error reporting by providing more detailed context about hex decoding errors.
  • Loading branch information
rockcoolsaint committed Jan 10, 2025
1 parent a4c12c6 commit 9a1612b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bitcoin/src/crypto/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,7 @@ impl fmt::Display for ParsePublicKeyError {
use ParsePublicKeyError::*;
match *self {
Encoding(ref e) => write_err!(f, "string error"; e),
InvalidChar(ref char) => write!(f, "hex error {}", char),
InvalidChar(ref e) => write_err!(f, "hex decoding"; e),
InvalidHexLength(got) =>
write!(f, "pubkey string should be 66 or 130 digits long, got: {}", got),
}
Expand Down

0 comments on commit 9a1612b

Please sign in to comment.