I'm not great with macros but I feel like it might get tricky if you have something like
create_error!(CombinedError: SomeError(Err1, Err2), AnotherError(Err1, Err2));
Maybe I am just underestimating the power of macros due to lack of experience though. I think in many cases, the nesting probably isn't a big problem as long as the errors implement Error::source
.
On another note, I wonder if it would be worth it to add a version that boxes all the variants to avoid increasing the size of the result, create_error_boxed!
or whatever.
I can imagine the name turning people off; I've hated error handling in every language I've used that has exceptions, including Java. This is something I disagree strongly with the OP on, though I think the crate looks good. cex is also a lot more complex so it's harder to get a handle on, whereas polyerror is super simple. I'm still not fully sure I "get" cex, explaining what it actually looks like after macro expansion in the docs like in the OP might help. In any case I think they both have interesting ideas for error handling.