Skip to content

Commit

Permalink
fix error. (#279)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssuchichan authored Jul 10, 2024
1 parent 57dfafe commit 0bc8ee9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions explorer/src/service/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ pub enum ExplorerError {
ReqwestErr(reqwest::Error),
ParseFloatErr(ParseFloatError),
}

impl From<ParseFloatError> for ExplorerError {
fn from(e: ParseFloatError) -> Self {
ExplorerError::ParseFloatErr(e)
}
}

impl From<reqwest::Error> for ExplorerError {
fn from(e: reqwest::Error) -> Self {
ExplorerError::ReqwestErr(e)
Expand Down Expand Up @@ -74,12 +76,12 @@ impl IntoResponse for ExplorerError {
fn into_response(self) -> Response {
let err_msg = match self {
ExplorerError::Custom(e) => e,
ExplorerError::DBErr(e) => {
if let RowNotFound = e {
ExplorerError::DBErr(e) => match e {
RowNotFound => {
return (StatusCode::NOT_FOUND, "not found").into_response();
}
e.to_string()
}
_ => e.to_string(),
},
ExplorerError::IOErr(e) => e.to_string(),
ExplorerError::TomlDeErr(e) => e.to_string(),
ExplorerError::HexErr(e) => e.to_string(),
Expand Down

0 comments on commit 0bc8ee9

Please sign in to comment.