Skip to content

Commit

Permalink
feat(dropper): added error conversions
Browse files Browse the repository at this point in the history
  • Loading branch information
SOmeone authored and t3hmrman committed Sep 11, 2024
1 parent be3a06e commit f44eb65
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions crates/async-dropper/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,16 @@ pub trait AsyncDrop: Default + PartialEq + Eq + ResetDefault {
DropFailAction::Continue
}
}

// Create an impl for AsyncDropError to allow ? to be used with AsyncDropError
impl From<Box<dyn std::error::Error>> for AsyncDropError {
fn from(value: Box<dyn std::error::Error>) -> Self {
AsyncDropError::UnexpectedError(value)
}
}
// Create a impl for anyhow::Error to allow ? to be used with AsyncDropError
impl From<anyhow::Error> for AsyncDropError {
fn from(value: anyhow::Error) -> Self {
AsyncDropError::UnexpectedError(Box::new(value))
}
}

0 comments on commit f44eb65

Please sign in to comment.