From 8c1b84c3d34a02d94cf556f6e62302fb54978658 Mon Sep 17 00:00:00 2001 From: Thi Doan Date: Mon, 7 Mar 2022 17:36:07 +0900 Subject: [PATCH] Do not hide BulkTransferException messages when there were more than one exception Previously, when there were more than one BulkTransferException, it would be reported like this: ``` Executing genrule //:foo failed: Exec failed due to IOException: 221 errors during bulk transfer ``` which didn't include the underlying exception messages. The only case that underlying exceptions were included was when there was only one exception. This change patches the error message to include all the exception messages, which helps diagnose BulkTransferException. --- .../build/lib/remote/common/BulkTransferException.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/google/devtools/build/lib/remote/common/BulkTransferException.java b/src/main/java/com/google/devtools/build/lib/remote/common/BulkTransferException.java index a70f4d66d3cac2..09dd9ea091be48 100644 --- a/src/main/java/com/google/devtools/build/lib/remote/common/BulkTransferException.java +++ b/src/main/java/com/google/devtools/build/lib/remote/common/BulkTransferException.java @@ -13,6 +13,7 @@ // limitations under the License. package com.google.devtools.build.lib.remote.common; +import com.google.common.base.Joiner; import java.io.IOException; /** @@ -57,6 +58,8 @@ public String getMessage() { if (super.getSuppressed().length == 1) { return super.getSuppressed()[0].getMessage(); } - return String.format("%d errors during bulk transfer", super.getSuppressed().length); + String errorSummary = String.format("%d errors during bulk transfer:", super.getSuppressed().length); + String combinedSuberrors = Joiner.on('\n').join(super.getSuppressed()); + return Joiner.on('\n').join(errorSummary, combinedSuberrors); } }