Skip to content

Commit 2668dd1

Browse files
authored
fix: add error description to batch emptiness validation (#2109)
When invoking BatchRequest#execute(), we ensure the batch contains at least one request to process. Previously this check, did not provide any error message. Now, if the check fails "Batch is empty" will be the message of the resulting exception. Related to googleapis/java-storage#694
1 parent 4fe04ff commit 2668dd1

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • google-api-client/src/main/java/com/google/api/client/googleapis/batch

google-api-client/src/main/java/com/google/api/client/googleapis/batch/BatchRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ public int size() {
228228
*/
229229
public void execute() throws IOException {
230230
boolean retryAllowed;
231-
Preconditions.checkState(!requestInfos.isEmpty());
231+
Preconditions.checkState(!requestInfos.isEmpty(), "Batch is empty");
232232

233233
// Log a warning if the user is using the global batch endpoint. In the future, we can turn this
234234
// into a preconditions check.

0 commit comments

Comments
 (0)