Skip to content

Commit

Permalink
Do not hide BulkTransferException messages when there were more than one
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
thii committed Mar 7, 2022
1 parent 0dc078a commit 158f4f9
Showing 1 changed file with 4 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,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);
}
}

0 comments on commit 158f4f9

Please sign in to comment.