Allow wrapping of errors
Binero opened this issue · 2 comments
Binero commented
It would be nice if something like this was possible:
quick_error! {
#[derive(Debug)]
pub enum MagicHeaderParseError {
Io(error: IoError) {
description(error.description())
display("{}", error.display())
cause(error.cause())
from(error: IoError) -> (error)
}
}
}
Right now this doesn't work, as description(...)
only accepts string literals, and cause cannot take Options.
tailhook commented
Here is a good example. The only issue is that cause isn't forwarded immediately. But I think the use case for cause
is to walk through the whole chain anyway, so it shouldn't be a problem.
Binero commented
Thank you. I see. I guess this can be closed as a duplicate then.