Throw InterruptedException directly if a query is interrupted, instead of wrapping it in a QueryException.

QueryException should usually indicate a persistent failure, while an InterruptedException is transient. Wrapping the InterruptedException in a QueryException just obfuscates state.

--
MOS_MIGRATED_REVID=97815388
diff --git a/src/main/java/com/google/devtools/build/lib/query2/BlazeQueryEnvironment.java b/src/main/java/com/google/devtools/build/lib/query2/BlazeQueryEnvironment.java
index a5c6d1d..db9d637 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/BlazeQueryEnvironment.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/BlazeQueryEnvironment.java
@@ -95,7 +95,8 @@
   }
 
   @Override
-  public BlazeQueryEvalResult<Target> evaluateQuery(QueryExpression expr) throws QueryException {
+  public BlazeQueryEvalResult<Target> evaluateQuery(QueryExpression expr)
+      throws QueryException, InterruptedException {
     // Some errors are reported as QueryExceptions and others as ERROR events (if --keep_going). The
     // result is set to have an error iff there were errors emitted during the query, so we reset
     // errors here.
@@ -241,16 +242,11 @@
   @Override
   public void buildTransitiveClosure(QueryExpression caller,
                                      Set<Target> targetNodes,
-                                     int maxDepth) throws QueryException {
+                                     int maxDepth) throws QueryException, InterruptedException {
     Set<Target> targets = targetNodes;
     preloadTransitiveClosure(targets, maxDepth);
-
-    try {
-      labelVisitor.syncWithVisitor(eventHandler, targets, keepGoing,
-          loadingPhaseThreads, maxDepth, errorObserver, new GraphBuildingObserver());
-    } catch (InterruptedException e) {
-      throw new QueryException(caller, "transitive closure computation was interrupted");
-    }
+    labelVisitor.syncWithVisitor(eventHandler, targets, keepGoing,
+        loadingPhaseThreads, maxDepth, errorObserver, new GraphBuildingObserver());
 
     if (errorObserver.hasErrors()) {
       reportBuildFileError(caller, "errors were encountered while computing transitive closure");