Skip to content

Commit

Permalink
bucket.go: downgrade early error check to a warning.
Browse files Browse the repository at this point in the history
So that mounting doesn't fail. Fixes #244.
  • Loading branch information
jacobsa committed Sep 4, 2017
1 parent 957d9ea commit 0f485db
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package main

import (
"fmt"
"os"
"path"
"time"

Expand Down Expand Up @@ -133,11 +134,13 @@ 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
// Check whether this bucket works, giving the user a warning early if there
// is some problem.
{
_, err := b.ListObjects(ctx, &gcs.ListObjectsRequest{MaxResults: 1})
if err != nil {
fmt.Fprintln(os.Stdout, "WARNING, bucket doesn't appear to work: ", err)
}
}

return
Expand Down

2 comments on commit 0f485db

@nafg
Copy link
Contributor

@nafg nafg commented on 0f485db Sep 5, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this. Shouldn't warnings go to stderr though? ;)

@jacobsa
Copy link
Contributor Author

@jacobsa jacobsa commented on 0f485db Sep 5, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sigh. Please feel free to argue about this on #242.

Please sign in to comment.