Chen-Yuan-Lai commented on code in PR #15946:
URL: https://github.com/apache/datafusion/pull/15946#discussion_r2086323971


##########
datafusion/common/src/error.rs:
##########
@@ -655,6 +671,20 @@ impl DataFusionError {
         queue.push_back(self);
         ErrorIterator { queue }
     }
+
+    /// Converts input to a [`GenericError`],
+    /// handling both regular values and pre-boxed errors to avoid 
double-boxing.
+    ///
+    /// The input must implement [`Into<GenericError>`], which includes:
+    /// [`Error`] types (implementing `std::error::Error + Send + Sync + 
'static`)
+    /// [`String`] and &str (automatically converted to errors)
+    /// [`Box<dyn Error + Send + Sync>`] (passed through without additional 
boxing)
+    pub fn box_error_if_needed<E>(err: E) -> GenericError
+    where
+        E: Into<GenericError>,
+    {
+        err.into()

Review Comment:
   Agree, but to prevent the compiler cannot resolve the target type for 
`e.into()`, I use `GenericError::from(e)` to explicitly provide the target type 



-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to