Merge rust-bitcoin/rust-bitcoin#3864: Update for ParsePublicKeyError Display and Error impl
b11ace359a
Fix up ParsePublickeyError (Innocent Onyemaenu) Pull request description: Resolves #3835 In #945fcd09 we forgot to Update impl for ParsePublicKeyError Display and Error traits ACKs for top commit: tcharding: ACKb11ace359a
apoelstra: ACK b11ace359a52d9137b8fe5919d9825d61e3e9fad; successfully ran local tests; thanks!! Tree-SHA512: 5c4e5e113605bc5b9c3c0d2ca65a0fdae80726a0f2f791255cc1d6567812a9132ff4f5bd8f30276fef916469d5fd29f6d72ddf4adb6340e52f4e0198ac4fb371
This commit is contained in:
commit
6bc12e9363
|
@ -1034,9 +1034,9 @@ impl From<Infallible> for ParsePublicKeyError {
|
|||
impl fmt::Display for ParsePublicKeyError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
use ParsePublicKeyError::*;
|
||||
match self {
|
||||
Encoding(e) => write_err!(f, "string error"; e),
|
||||
InvalidChar(char) => write!(f, "hex error {}", char),
|
||||
match *self {
|
||||
Encoding(ref e) => write_err!(f, "string error"; e),
|
||||
InvalidChar(ref e) => write_err!(f, "hex decoding"; e),
|
||||
InvalidHexLength(got) =>
|
||||
write!(f, "pubkey string should be 66 or 130 digits long, got: {}", got),
|
||||
}
|
||||
|
@ -1048,9 +1048,10 @@ impl std::error::Error for ParsePublicKeyError {
|
|||
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
|
||||
use ParsePublicKeyError::*;
|
||||
|
||||
match self {
|
||||
Encoding(e) => Some(e),
|
||||
InvalidChar(_) | InvalidHexLength(_) => None,
|
||||
match *self {
|
||||
Encoding(ref e) => Some(e),
|
||||
InvalidChar(ref e) => Some(e),
|
||||
InvalidHexLength(_) => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue