Skip to content

Commit 64e2b2e

Browse files
authored
fix: update grpc single-shot uploads to attach the callers stracktrace as suppressed exception if an error happens in the background (#3330)
1 parent ab89a66 commit 64e2b2e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

google-cloud-storage/src/main/java/com/google/cloud/storage/GapicUnbufferedDirectWritableByteChannel.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,11 +273,14 @@ void await() {
273273
try {
274274
invocationHandle.get();
275275
} catch (InterruptedException | ExecutionException e) {
276+
RuntimeException runtimeException;
276277
if (e.getCause() instanceof RuntimeException) {
277-
throw (RuntimeException) e.getCause();
278+
runtimeException = (RuntimeException) e.getCause();
278279
} else {
279-
throw new RuntimeException(e);
280+
runtimeException = new RuntimeException(e);
280281
}
282+
runtimeException.addSuppressed(new AsyncStorageTaskException());
283+
throw runtimeException;
281284
}
282285
}
283286
}

0 commit comments

Comments
 (0)