thinkharderdev commented on issue #5345:
URL: https://github.com/apache/arrow-rs/issues/5345#issuecomment-1917313262
What about adding a enum `object_store::ErrorKind` and then have
```
pub enum Error {
#[snafu(display("Generic {} error: {}", store, source))]
Generic {
store: &'static str,
kind: Option<ErrorKind>,
source: Box<dyn std::error::Error + Send + Sync + 'static>,
},
...
}
```
This is somewhat redundant because `object_store::ErrorKind` would be almost
the same as `std::io::ErrorKind` but would give us flexibility to be precise,
This would of course also be a breaking change as written above but could
also be done as a non-breaking change if we internalized it as a method, so
```
pub enum ErrorKind {
InvalidInput,
IO,
PermissionDenied,
PreconditionFailed,
...
}
impl From<&StatusCode> for ErrorKind {
... map HTTP status codes to kinds
}
impl Error {
pub fn kind(&self) -> Option<object_store::ErrorKind> {
match self {
Error::Generic { source, .. } => {
match source.downcast_ref::<retry::Error>() {
Some(retry::Error::Client { status, .. }) => return
Some(status.into()),
...,
None => ()
};
... other mappings ....
}
}
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]