Let's say I have a crate Lib1
that declares something like:
#[macro_use]
extern crate quick_error;
quick_error! {
#[derive(Debug)]
pub enum MyError {
Foo {
description("FooError")
}
}
}
I have some another library Lib2
that depends on Lib1
.
I would like to extend this MyError
with some additional errors that are specific to Lib2
. That way I can reuse all the base errors that were declared in Lib1
.
Btw, I have complete control on both libraries and I can modify them as much as I need to. I definitely would like to keep using quick-error
for this. Is it possible to extend this somehow?
Note: I already had a look at Can I extend an enum with additional values? That was definitely something I knew about before opening the question.
This does not solve this specific problem. Ideally I would like to keep using quick_error
. Plus using composition for error makes error handling downstream very complicated. Is there a nice pattern for extending errors in libraries?