Re:Rust 2019: Tame Complexity through Community Involvement ...
by smaddox on Tuesday January 01, 2019 @03:24PM
(#18802106)
You should try using `map_err` and the `?` operator, with your own error enum defined using the `failure_derive` crate, for example:
[ Parent
| on HN ]
Re:Rust 2019: Tame Complexity through Community Involvement ...
by kouteiheika on Tuesday January 01, 2019 @04:42PM
(#18802568)
A tip - you usually don't need lambdas in such cases; this should work:
foo().map_err(MyError::FooError)?
.bar().map_err(MyError::BarError)?;