Skip to content

Commit e030422

Browse files
Ian LaiIan Lai
Ian Lai
authored and
Ian Lai
committed
feat: remove box_error_if_needed method and update external_datafusion_err macro to convert input directly to GenericError
1 parent 9440051 commit e030422

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

datafusion/common/src/error.rs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -671,20 +671,6 @@ impl DataFusionError {
671671
queue.push_back(self);
672672
ErrorIterator { queue }
673673
}
674-
675-
/// Converts input to a [`GenericError`],
676-
/// handling both regular values and pre-boxed errors to avoid double-boxing.
677-
///
678-
/// The input must implement [`Into<GenericError>`], which includes:
679-
/// [`Error`] types (implementing `std::error::Error + Send + Sync + 'static`)
680-
/// [`String`] and &str (automatically converted to errors)
681-
/// [`Box<dyn Error + Send + Sync>`] (passed through without additional boxing)
682-
pub fn box_error_if_needed<E>(err: E) -> GenericError
683-
where
684-
E: Into<GenericError>,
685-
{
686-
err.into()
687-
}
688674
}
689675

690676
/// A builder for [`DataFusionError`]
@@ -937,9 +923,9 @@ macro_rules! schema_err {
937923
#[macro_export]
938924
macro_rules! external_datafusion_err {
939925
($CONVERTIBLE_TO_ERR:expr $(; diagnostic = $DIAG:expr)?) => {{
940-
let boxed_err = $crate::DataFusionError::box_error_if_needed($CONVERTIBLE_TO_ERR);
941926
let err = $crate::error::DataFusionError::External(
942-
boxed_err,
927+
// covert input to GenericError
928+
$crate::error::GenericError::from($CONVERTIBLE_TO_ERR),
943929
Some($crate::error::DataFusionError::get_back_trace())
944930
);
945931
$(

0 commit comments

Comments
 (0)