Skip to content

Commit f63ab44

Browse files
chemidyhiranya911
authored andcommitted
add check on err != nil (#194)
1 parent a75b859 commit f63ab44

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

firebase_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ func TestClientOptions(t *testing.T) {
7373
defer ts.Close()
7474

7575
b, err := mockServiceAcct(ts.URL)
76+
if err != nil {
77+
t.Fatal(err)
78+
}
79+
7680
config, err := google.JWTConfigFromJSON(b)
7781
if err != nil {
7882
t.Fatal(err)

snippets/messaging.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ func sendToToken(app *firebase.App) {
3030
// Obtain a messaging.Client from the App.
3131
ctx := context.Background()
3232
client, err := app.Messaging(ctx)
33+
if err != nil {
34+
log.Fatalf("error getting Messaging client: %v\n", err)
35+
}
3336

3437
// This registration token comes from the client FCM SDKs.
3538
registrationToken := "YOUR_REGISTRATION_TOKEN"

0 commit comments

Comments
 (0)