Closed DCjanus closed 2 years ago
People using magick-rust and anyhow would suffer from error transform like this
magick-rust
anyhow
fn foo() -> anyhow::Result<()> [ magick_wand.some_method().map_err(|e|anyhow!())? Ok(()) }
If we are using Result type like this, things would be easier:
Result
struct MagickError(&'static str); impl From<&'static str> for MagickError { fn from(s: &'static str) -> Self { MagickError(s) } } fn foo1() -> Result<(), MagickError> { Err("something went wrong")?; Ok(()) } fn foo2() -> Result<(), MagickError> { foo1()?; Ok(()) } fn foo3() -> anyhow::Result<()> { foo2()?; Ok(()) }
I do believe there would be a lot of boring work, I'd like to handle this, since I really like this.
People using
magick-rust
andanyhow
would suffer from error transform like thisIf we are using
Result
type like this, things would be easier:I do believe there would be a lot of boring work, I'd like to handle this, since I really like this.