From 957ebaeca99c871b7875c4ff04fd392718240f03 Mon Sep 17 00:00:00 2001 From: Innocent Onyemaenu Date: Fri, 10 Jan 2025 01:18:38 +0100 Subject: [PATCH] In #945fcd09 we forgot to Update impl for ParsePublicKeyError Display 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. --- bitcoin/src/crypto/key.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitcoin/src/crypto/key.rs b/bitcoin/src/crypto/key.rs index 9c0abb3025..81849f3c1b 100644 --- a/bitcoin/src/crypto/key.rs +++ b/bitcoin/src/crypto/key.rs @@ -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), }