Skip to content

Commit

Permalink
Refactor to prevent name collisions
Browse files Browse the repository at this point in the history
  • Loading branch information
chevdor committed Apr 12, 2023
1 parent fd047d7 commit a7eb344
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/src/chain_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,20 @@ impl ChainInfo {
}

#[derive(Debug)]
pub enum Error {
pub enum ChainInfoError {
ChainUsupported(String),
}

impl Display for Error {
impl Display for ChainInfoError {
fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Error::ChainUsupported(s) => write!(fmt, "Chain not supported: {s}"),
ChainInfoError::ChainUsupported(s) => write!(fmt, "Chain not supported: {s}"),
}
}
}

impl FromStr for ChainInfo {
type Err = Error;
type Err = ChainInfoError;

fn from_str(name: &str) -> Result<Self, Self::Err> {
let name = name.to_lowercase();
Expand All @@ -67,7 +67,7 @@ impl FromStr for ChainInfo {
if let Some(endpoints) = urls {
Ok(Self { name, endpoints })
} else {
Err(Error::ChainUsupported(name))
Err(ChainInfoError::ChainUsupported(name))
}
}
}
Expand Down

0 comments on commit a7eb344

Please sign in to comment.