eliaperantoni commented on issue #14432:
URL: https://github.com/apache/datafusion/issues/14432#issuecomment-2677625958

   Hey @Chen-Yuan-Lai, thank you so much for your contributions 🙏 That is 
indeed an annoying issue. It seems like some of the error macros "flatten" the 
inner error to a string.
   
   I think I'm in favour of option 2, in hope that there are not too many 
places where this flattening happens. I wouldn't go for option 1 because, as 
you say, it would change all existing macro invocations.
   
   Perhaps we want is a `DataFusionError::map_diagnosticed_err` method? It 
would:
   
   1. Check if `&self` is a `DataFusionError::Diagnostic`
   2. If so, apply a closure to the wrapper error.
   
   i.e. then you would do:
   
   
   ```rust
   let err1 = exec_err!("need to download more RAM");
   let err2 = err1.with_diagnostic(...);
   let err3 = err2.map_diagnosticed_err(|err| 
       plan_err!("that went wrong {}", err);
   );
   ```
   
   And now `err2` would be a `Diagnostic(ExecError)` and `err3` would be a 
`Diagnostic(PlanError)`.
   
   I'm not sure if this would work or make for a good implementation, but I 
hope it can help in any way :)


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