avantgardnerio commented on code in PR #2885: URL: https://github.com/apache/arrow-datafusion/pull/2885#discussion_r925843563
########## datafusion/common/src/error.rs: ########## @@ -83,6 +83,30 @@ pub enum DataFusionError { #[cfg(feature = "jit")] /// Error occurs during code generation JITError(ModuleError), + /// Error with context Review Comment: I would +1 any solution that allows nested errors (our own, or off-the-shelf). This was inspired by heavily commented code like: ``` let subqry_input = only_or_err(subqry_inputs.as_slice()); // correlated where in subqueries must project a single expression ``` Turning into something that also benefits the user when it breaks like: ``` let subqry_input = only_or_err(subqry_inputs.as_slice()) .map_err(|e| context!("single expression projection required", e))?; ``` With the `context!` macro providing the relevant information about which optimizer was being run, and turned the error from `more than one item found in list!` into `"single expression projection required in decorrelate_where_in line 123" caused by "more than one item found in list!"` which seemed like a much better user experience. -- 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...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org