-
Notifications
You must be signed in to change notification settings - Fork 853
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add External
variant to ParquetError
#3285
Comments
First attempt has failed, that modification requires more changes that I thought due to primitive String/usize based errors equality |
Perhaps we could roll this into #2725 |
Sure that would make sense |
I have seen that
|
I believe anyhow supports this natively with https://docs.rs/anyhow/latest/anyhow/struct.Error.html#method.root_cause Additionally the way it handles downcasting in general is if the target type appears anywhere in the chain, so it is agnostic to any additional context added https://docs.rs/anyhow/latest/anyhow/trait.Context.html#effect-on-downcasting Its a pretty well thought out crate imo 😀 |
Sure It has that kind of support. My point was It would be interesting pattern if libraries would provide enumeration of known errors that is hidden behind dynamic error that allows enriching context. The macro is a boilerplate, anyhow error needs to be created at the call site that, to capture backtrace correctly (at the call site, not in e.g. ParquetError::new(...)). It is interesting that downcast might match any node in the chain that match provided type. From my perspective the most important is the root cause, because It tells why the error has happened. Anything in between is just an additional context. |
|
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
It would be nice to have
External(Box<dyn error::Error + Send + Sync>)
variant in ParquetError, because right now I cannot bubble up errors with preserving source through existing ParquetError variants that only accepts eitherString
orusize
.If we would add such variant, then
impl std::error::Error for ParquetError { ... }
should bubble upcause
forExternal
variant.The text was updated successfully, but these errors were encountered: