Forgive me, it’s been a month since I worked on this code so I’ve forgotten some, but it looks to me like there would be coherence violations in the From conversions, e.g.
impl From<$link_error_path> for $error_name {
fn from(e: $link_error_path) -> Self {
$error_name($error_kind_name::$link_variant(e.0), e.1)
}
}
I tried this to start and couldn’t formulate it in a way that worked with coherence. As long as you only create one type of error per crate the scenario you describe of needing multiple ChainErr shouldn’t happen.
It’s not a wrapper, it’s a type alias. A person could write it as a one liner, but I figured since I was doing all the other definitions, and it’s common practice to do the type alias, the macro should just do it.
It’s not currently, but I can see it might be worth while. Personally, even if it’s not useful in some scenarios I wouldn’t have a desire to turn it off. The reason I see to disable it is to save the work of generating it, but I also consider it a design tradeoff that (in this library at least) performance on the error path is not critical (lots of boxing in this strategy).
I think I agree with that too, but I would also suggest that backtraces are useful for debugging unexpected errors. It’s reasonably common to get bug reports that show an error that my program printed, and for me to have no idea why that would happen. If I can say ‘will you run that again with backtraces on?’ it will help me figure out what happened.