@@ -903,76 +903,75 @@ macro_rules! assert_ne_or_internal_err {
903903/// plan_err!("Error {val:?}")
904904///
905905/// `NAME_ERR` - macro name for wrapping Err(DataFusionError::*)
906+ /// `PREFIXED_NAME_ERR` - underscore-prefixed alias for NAME_ERR (e.g., _plan_err)
906907/// `NAME_DF_ERR` - macro name for wrapping DataFusionError::*. Needed to keep backtrace opportunity
907908/// in construction where DataFusionError::* used directly, like `map_err`, `ok_or_else`, etc
909+ /// `PREFIXED_NAME_DF_ERR` - underscore-prefixed alias for NAME_DF_ERR (e.g., _plan_datafusion_err)
908910macro_rules! make_error {
909- ( $NAME_ERR: ident, $NAME_DF_ERR : ident, $ERR : ident) => { make_error! ( @inner ( $ ) , $NAME_ERR , $NAME_DF_ERR , $ ERR) ; } ;
910- ( @inner ( $d : tt ) , $NAME_ERR: ident , $NAME_DF_ERR: ident , $ERR: ident ) => {
911- :: paste :: paste! {
912- /// Macro wraps ` $ERR` to add backtrace feature
913- # [ macro_export ]
914- macro_rules! $NAME_DF_ERR {
915- ( $d ( $d args : expr ) , * $d ( ; diagnostic=$d DIAG : expr ) ? ) => { {
916- let err =$crate :: DataFusionError :: $ERR (
917- :: std :: format! (
918- "{}{}" ,
919- :: std :: format! ( $d ( $d args ) , * ) ,
920- $crate :: DataFusionError :: get_back_trace ( ) ,
921- ) . into ( )
922- ) ;
923- $d (
924- let err = err . with_diagnostic ( $d DIAG ) ;
925- ) ?
926- err
927- }
928- }
911+ ( $NAME_ERR: ident, $PREFIXED_NAME_ERR : ident, $NAME_DF_ERR : ident, $PREFIXED_NAME_DF_ERR : ident , $ERR: ident ) => {
912+ make_error! ( @inner ( $) , $NAME_ERR, $PREFIXED_NAME_ERR , $ NAME_DF_ERR, $PREFIXED_NAME_DF_ERR , $ ERR) ;
913+ } ;
914+ ( @inner ( $d : tt ) , $NAME_ERR : ident , $PREFIXED_NAME_ERR : ident , $NAME_DF_ERR : ident , $PREFIXED_NAME_DF_ERR : ident , $ERR: ident ) => {
915+ /// Macro wraps `$ERR` to add backtrace feature
916+ # [ macro_export ]
917+ macro_rules! $NAME_DF_ERR {
918+ ( $d ( $d args : expr ) , * $d ( ; diagnostic=$d DIAG : expr ) ? ) => { {
919+ let err = $crate :: DataFusionError :: $ERR (
920+ :: std :: format! (
921+ "{}{}" ,
922+ :: std :: format! ( $d ( $d args ) , * ) ,
923+ $crate :: DataFusionError :: get_back_trace ( ) ,
924+ ) . into ( )
925+ ) ;
926+ $d (
927+ let err = err . with_diagnostic ( $d DIAG ) ;
928+ ) ?
929+ err
930+ } }
929931 }
930932
931- /// Macro wraps Err(`$ERR`) to add backtrace feature
932- #[ macro_export]
933- macro_rules! $NAME_ERR {
934- ( $d( $d args: expr) , * $d( ; diagnostic = $d DIAG : expr) ?) => { {
935- let err = $crate:: [ <_ $NAME_DF_ERR>] !( $d( $d args) , * ) ;
936- $d (
937- let err = err. with_diagnostic( $d DIAG ) ;
938- ) ?
939- Err ( err)
940-
941- } }
942- }
943-
944-
945- #[ doc( hidden) ]
946- pub use $NAME_ERR as [ <_ $NAME_ERR>] ;
947- #[ doc( hidden) ]
948- pub use $NAME_DF_ERR as [ <_ $NAME_DF_ERR>] ;
933+ /// Macro wraps Err(`$ERR`) to add backtrace feature
934+ #[ macro_export]
935+ macro_rules! $NAME_ERR {
936+ ( $d( $d args: expr) , * $d( ; diagnostic = $d DIAG : expr) ?) => { {
937+ let err = $crate:: $PREFIXED_NAME_DF_ERR!( $d( $d args) , * ) ;
938+ $d (
939+ let err = err. with_diagnostic( $d DIAG ) ;
940+ ) ?
941+ Err ( err)
942+ } }
949943 }
944+
945+ #[ doc( hidden) ]
946+ pub use $NAME_ERR as $PREFIXED_NAME_ERR;
947+ #[ doc( hidden) ]
948+ pub use $NAME_DF_ERR as $PREFIXED_NAME_DF_ERR;
950949 } ;
951950}
952951
953952// Exposes a macro to create `DataFusionError::Plan` with optional backtrace
954- make_error ! ( plan_err, plan_datafusion_err, Plan ) ;
953+ make_error ! ( plan_err, _plan_err , plan_datafusion_err, _plan_datafusion_err , Plan ) ;
955954
956955// Exposes a macro to create `DataFusionError::Internal` with optional backtrace
957- make_error ! ( internal_err, internal_datafusion_err, Internal ) ;
956+ make_error ! ( internal_err, _internal_err , internal_datafusion_err, _internal_datafusion_err , Internal ) ;
958957
959958// Exposes a macro to create `DataFusionError::NotImplemented` with optional backtrace
960- make_error ! ( not_impl_err, not_impl_datafusion_err, NotImplemented ) ;
959+ make_error ! ( not_impl_err, _not_impl_err , not_impl_datafusion_err, _not_impl_datafusion_err , NotImplemented ) ;
961960
962961// Exposes a macro to create `DataFusionError::Execution` with optional backtrace
963- make_error ! ( exec_err, exec_datafusion_err, Execution ) ;
962+ make_error ! ( exec_err, _exec_err , exec_datafusion_err, _exec_datafusion_err , Execution ) ;
964963
965964// Exposes a macro to create `DataFusionError::Configuration` with optional backtrace
966- make_error ! ( config_err, config_datafusion_err, Configuration ) ;
965+ make_error ! ( config_err, _config_err , config_datafusion_err, _config_datafusion_err , Configuration ) ;
967966
968967// Exposes a macro to create `DataFusionError::Substrait` with optional backtrace
969- make_error ! ( substrait_err, substrait_datafusion_err, Substrait ) ;
968+ make_error ! ( substrait_err, _substrait_err , substrait_datafusion_err, _substrait_datafusion_err , Substrait ) ;
970969
971970// Exposes a macro to create `DataFusionError::ResourcesExhausted` with optional backtrace
972- make_error ! ( resources_err, resources_datafusion_err, ResourcesExhausted ) ;
971+ make_error ! ( resources_err, _resources_err , resources_datafusion_err, _resources_datafusion_err , ResourcesExhausted ) ;
973972
974973// Exposes a macro to create `DataFusionError::Ffi` with optional backtrace
975- make_error ! ( ffi_err, ffi_datafusion_err, Ffi ) ;
974+ make_error ! ( ffi_err, _ffi_err , ffi_datafusion_err, _ffi_datafusion_err , Ffi ) ;
976975
977976// Exposes a macro to create `DataFusionError::SQL` with optional backtrace
978977#[ macro_export]
0 commit comments