You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "jpountz (via GitHub)" <gi...@apache.org> on 2023/09/05 09:33:53 UTC

[GitHub] [lucene] jpountz commented on a diff in pull request #12516: Unwrap execution exceptions cause and rethrow as is when possible

jpountz commented on code in PR #12516:
URL: https://github.com/apache/lucene/pull/12516#discussion_r1315641242


##########
lucene/core/src/java/org/apache/lucene/search/TaskExecutor.java:
##########
@@ -57,6 +58,12 @@ final <T> List<T> invokeAll(Collection<RunnableFuture<T>> tasks) {
       } catch (InterruptedException e) {
         throw new ThreadInterruptedException(e);
       } catch (ExecutionException e) {
+        if (e.getCause() instanceof IOException ioException) {
+          throw ioException;
+        }
+        if (e.getCause() instanceof RuntimeException runtimeException) {
+          throw runtimeException;
+        }
         throw new RuntimeException(e.getCause());

Review Comment:
   Maybe reuse `IOUtils#rethrowAlways` here? `throw IOUtils.rethrowAlways(e.getCause());`



-- 
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: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org