egolearner commented on code in PR #49860:
URL: https://github.com/apache/arrow/pull/49860#discussion_r3249727185


##########
cpp/src/arrow/util/async_util_test.cc:
##########
@@ -204,6 +205,31 @@ TEST(AsyncTaskScheduler, InitialTaskFails) {
   ASSERT_FINISHES_AND_RAISES(Invalid, finished);
 }
 
+TEST(AsyncTaskScheduler, InitialTaskThrowsException) {
+  // If the initial task throws a C++ exception (not a Status), the scheduler
+  // should catch it, convert to a failed Status, and not hang indefinitely.
+  // See https://github.com/apache/arrow/issues/47642
+
+  // Case 1: initial task throws with no other tasks
+  Future<> finished =
+      AsyncTaskScheduler::Make([&](AsyncTaskScheduler* scheduler) -> Status {
+        throw std::runtime_error("some exception");

Review Comment:
   * `stdexcept` included.
   * I'd prefer to skip this. Modern C++ code shouldn't be throwing 
non-`std::exception` types in the first place — the `catch (...)` branch is 
purely a safety net. 
   



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to