Skip to content

Commit

Permalink
impl From
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex6323 committed Oct 16, 2023
1 parent eda1fe8 commit bc5b622
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sdk/src/types/block/address/bech32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl FromStr for Hrp {
type Err = Error;

fn from_str(hrp: &str) -> Result<Self, Self::Err> {
Ok(Self(bech32::Hrp::parse(hrp).map_err(Error::InvalidBech32Hrp)?))
Ok(Self(bech32::Hrp::parse(hrp)?))
}
}

Expand Down
6 changes: 6 additions & 0 deletions sdk/src/types/block/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,12 @@ impl fmt::Display for Error {
}
}

impl From<Bech32HrpError> for Error {
fn from(error: Bech32HrpError) -> Self {
Self::InvalidBech32Hrp(error)
}
}

impl From<CryptoError> for Error {
fn from(error: CryptoError) -> Self {
Self::Crypto(error)
Expand Down

0 comments on commit bc5b622

Please sign in to comment.