Skip to content

Commit

Permalink
Do not hide BulkTransferException messages when there were more than …
Browse files Browse the repository at this point in the history
…one exception (#14986)

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.

Closes #14981.

PiperOrigin-RevId: 432921283
(cherry picked from commit 113eaca)

Co-authored-by: Thi Doan <t@thi.im>
  • Loading branch information
brentleyjones and thii authored Mar 7, 2022
1 parent b480480 commit 61cfa1d
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -57,6 +58,9 @@ 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);
}
}

0 comments on commit 61cfa1d

Please sign in to comment.