Skip to content

Commit

Permalink
fix: return error from NewClient if projectID is not set
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregory-Ledray authored and Gregory Ledray committed Jun 22, 2021
1 parent 598f5b9 commit 58f2952
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions firestore/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ type Client struct {

// NewClient creates a new Firestore client that uses the given project.
func NewClient(ctx context.Context, projectID string, opts ...option.ClientOption) (*Client, error) {
if projectID == "" {
return nil, errors.New("firestore: projectID was empty")
}
var o []option.ClientOption
// If this environment variable is defined, configure the client to talk to the emulator.
if addr := os.Getenv("FIRESTORE_EMULATOR_HOST"); addr != "" {
Expand Down

0 comments on commit 58f2952

Please sign in to comment.