Skip to content

Commit

Permalink
fix: add error description to batch emptiness validation (#2109)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
BenWhitehead authored and blakeli0 committed Dec 16, 2022
1 parent ae1e848 commit e811a0d
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public int size() {
*/
public void execute() throws IOException {
boolean retryAllowed;
Preconditions.checkState(!requestInfos.isEmpty());
Preconditions.checkState(!requestInfos.isEmpty(), "Batch is empty");

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

0 comments on commit e811a0d

Please sign in to comment.