|
|
|
|
|
by dakom
2726 days ago
|
|
> every single Rust crate I have used so far its creating its own `Error` enum which makes it really hard to compose `Result`. Is there a reason why `map_err()` doesn't achieve what you need - i.e. to get everything into your error type no matter where it came from? For example: OtherLibResult.map_err(|e| MyError::from(e)) Unless I'm mistaken - you ultimately are doing something like this in one form or another, because if you never match on the different Error variants that happened somewhere along the pipeline- then those details are being swallowed. Implementing a From trait at least forces you to make that choice (all in one place too)- and then you can keep composing the results as needed since it's all in your MyError type |
|