From 5658dac02484e28e9455c45b454e054422b7e135 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Wed, 4 Oct 2023 12:21:10 +1100 Subject: [PATCH] Add suffix to UnknownChainHash error type By convention we always include the suffix "Error" on our error types. Rename the error type `UnknownChainHash` to `UnknownChainHashError`. --- bitcoin/src/network.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bitcoin/src/network.rs b/bitcoin/src/network.rs index 9e128d4e..895a4d93 100644 --- a/bitcoin/src/network.rs +++ b/bitcoin/src/network.rs @@ -238,18 +238,18 @@ impl fmt::Display for Network { /// Error in parsing network from chain hash. #[derive(Debug, Clone, PartialEq, Eq)] -pub struct UnknownChainHash(ChainHash); +pub struct UnknownChainHashError(ChainHash); -impl Display for UnknownChainHash { +impl Display for UnknownChainHashError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "unknown chain hash: {}", self.0) } } -impl_std_error!(UnknownChainHash); +impl_std_error!(UnknownChainHashError); impl TryFrom for Network { - type Error = UnknownChainHash; + type Error = UnknownChainHashError; fn try_from(chain_hash: ChainHash) -> Result { match chain_hash { @@ -258,7 +258,7 @@ impl TryFrom for Network { ChainHash::TESTNET => Ok(Network::Testnet), ChainHash::SIGNET => Ok(Network::Signet), ChainHash::REGTEST => Ok(Network::Regtest), - _ => Err(UnknownChainHash(chain_hash)), + _ => Err(UnknownChainHashError(chain_hash)), } } }