paleolimbot commented on code in PR #13397:
URL: https://github.com/apache/arrow/pull/13397#discussion_r918200653


##########
r/src/safe-call-into-r.h:
##########
@@ -93,7 +100,8 @@ MainRThread& GetMainRThread();
 // a SEXP (use cpp11::as_cpp<T> to convert it to a C++ type inside
 // `fun`).
 template <typename T>
-arrow::Future<T> SafeCallIntoRAsync(std::function<arrow::Result<T>(void)> fun) 
{
+arrow::Future<T> SafeCallIntoRAsync(std::function<arrow::Result<T>(void)> fun,
+                                    std::string reason = "unspecified") {

Review Comment:
   The `UnknownError` is never actually surfaced...when `ClearError()` is 
called (by `RunWithCapturedR()`) then a `cpp11::unwind_exception()` is thrown, 
which surfaces the original error. For a slightly different situation I added 
the `StatusDetail` + unwind token thing and wired it into `StopIfNotOk()` ( 
https://github.com/apache/arrow/blob/master/r/src/arrow_types.h#L80-L113 ). I 
added comments to hopefully explain how this works and changed the main R 
thread error handling to use a Status so that the logic all lives in the same 
place.



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

Reply via email to