You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/07/06 16:46:29 UTC

[GitHub] [beam] damccorm commented on a diff in pull request #22079: [fixes #22078] Propogate error messages from GcsUtil

damccorm commented on code in PR #22079:
URL: https://github.com/apache/beam/pull/22079#discussion_r915055121


##########
sdks/java/extensions/google-cloud-platform-core/src/main/java/org/apache/beam/sdk/extensions/gcp/util/GcsUtil.java:
##########
@@ -640,6 +648,19 @@ boolean bucketAccessible(GcsPath path, BackOff backoff, Sleeper sleeper) throws
     }
   }
 
+  /**
+   * Checks whether the GCS bucket exists. Throws exception if the bucket is inaccessible due to
+   * permissions or does not exist.

Review Comment:
   Can't it throw for more reasons? https://github.com/apache/beam/blob/6dea0d15d0a97d243a2fe56684c2e193cbea14d2/sdks/java/extensions/google-cloud-platform-core/src/main/java/org/apache/beam/sdk/extensions/gcp/util/GcsUtil.java#L673



##########
sdks/java/extensions/google-cloud-platform-core/src/main/java/org/apache/beam/sdk/extensions/gcp/util/GcsUtil.java:
##########
@@ -640,6 +648,19 @@ boolean bucketAccessible(GcsPath path, BackOff backoff, Sleeper sleeper) throws
     }
   }
 
+  /**
+   * Checks whether the GCS bucket exists. Throws exception if the bucket is inaccessible due to
+   * permissions or does not exist.
+   */
+  @VisibleForTesting
+  void verifyBucketAccessible(GcsPath path, BackOff backoff, Sleeper sleeper) throws IOException {
+    try {
+      getBucket(path, backoff, sleeper);
+    } catch (AccessDeniedException | FileNotFoundException e) {
+      throw e;

Review Comment:
   What does rethrowing get us here? Won't this exception be thrown regardless (whether its an AccessDeniedException/FileNotFoundException or not)? (That seems like what we'd want as well)



-- 
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-unsubscribe@beam.apache.org

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