Skip to content

Commit

Permalink
bucket.go: check the bucket works before returning it.
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobsa committed May 24, 2017
1 parent df1953f commit acf20a1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,5 +133,12 @@ func setUpBucket(
b)
}

// Ensure the bucket works, catching problems early.
_, err = b.ListObjects(ctx, &gcs.ListObjectsRequest{MaxResults: 1})
if err != nil {
err = fmt.Errorf("checking bucket works: %v", err)
return
}

return
}

0 comments on commit acf20a1

Please sign in to comment.