shepmaster / snafu

Easily assign underlying errors into domain-specific errors while adding context
https://docs.rs/snafu/
Apache License 2.0
1.45k stars 61 forks source link

Add a way to construct a leaf error without wrapping it in a Result #221

Closed shepmaster closed 4 years ago

shepmaster commented 4 years ago

Right now, sometimes we end up with code like

Variant.fail::<()>.unwrap_err()

This usually occurs when interoperating with systems that already have a Result, such as when used in Result::map_err.

We could add a new function that just generates the error, not wrapping it.


Related but different from the comment in #46:

manually construct an error variant with a source error