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`.
This commit is contained in:
parent
2fb71dd943
commit
5658dac024
|
@ -238,18 +238,18 @@ impl fmt::Display for Network {
|
||||||
|
|
||||||
/// Error in parsing network from chain hash.
|
/// Error in parsing network from chain hash.
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[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 {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
write!(f, "unknown chain hash: {}", self.0)
|
write!(f, "unknown chain hash: {}", self.0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_std_error!(UnknownChainHash);
|
impl_std_error!(UnknownChainHashError);
|
||||||
|
|
||||||
impl TryFrom<ChainHash> for Network {
|
impl TryFrom<ChainHash> for Network {
|
||||||
type Error = UnknownChainHash;
|
type Error = UnknownChainHashError;
|
||||||
|
|
||||||
fn try_from(chain_hash: ChainHash) -> Result<Self, Self::Error> {
|
fn try_from(chain_hash: ChainHash) -> Result<Self, Self::Error> {
|
||||||
match chain_hash {
|
match chain_hash {
|
||||||
|
@ -258,7 +258,7 @@ impl TryFrom<ChainHash> for Network {
|
||||||
ChainHash::TESTNET => Ok(Network::Testnet),
|
ChainHash::TESTNET => Ok(Network::Testnet),
|
||||||
ChainHash::SIGNET => Ok(Network::Signet),
|
ChainHash::SIGNET => Ok(Network::Signet),
|
||||||
ChainHash::REGTEST => Ok(Network::Regtest),
|
ChainHash::REGTEST => Ok(Network::Regtest),
|
||||||
_ => Err(UnknownChainHash(chain_hash)),
|
_ => Err(UnknownChainHashError(chain_hash)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue