crepererum commented on code in PR #16947:
URL: https://github.com/apache/datafusion/pull/16947#discussion_r2239333092


##########
datafusion/common/src/error.rs:
##########
@@ -47,6 +47,61 @@ pub type SharedResult<T> = result::Result<T, 
Arc<DataFusionError>>;
 /// Error type for generic operations that could result in 
DataFusionError::External
 pub type GenericError = Box<dyn Error + Send + Sync>;
 
+#[cfg(feature = "object_store")]
+#[derive(Debug)]
+pub struct DfObjectStoreError {
+    pub source: Box<dyn Error + Send + Sync>,
+    pub context: Option<String>,
+}
+
+#[cfg(feature = "object_store")]
+impl DfObjectStoreError {
+    pub fn new(source: impl Into<Box<dyn Error + Send + Sync>>) -> Self {
+        Self {
+            source: source.into(),
+            context: None,
+        }
+    }
+
+    pub fn with_context(
+        source: impl Into<Box<dyn Error + Send + Sync>>,
+        context: impl Into<String>,
+    ) -> Self {
+        Self {
+            source: source.into(),
+            context: Some(context.into()),
+        }
+    }
+}
+
+#[cfg(feature = "object_store")]
+impl Display for DfObjectStoreError {
+    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
+        Display::fmt(self.source.as_ref(), f)
+    }
+}
+
+#[cfg(feature = "object_store")]
+impl Error for DfObjectStoreError {
+    fn source(&self) -> Option<&(dyn Error + 'static)> {

Review Comment:
   I think the migration guide for this change should probably mention that you 
CAN still get the underlying error if you downcast the source. Some people may 
want to do this to get more detailed information about the nature of the error, 
e.g. to determine if it was a connection issue or a permission issue.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to