Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions gcm.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,15 @@ func RegisterGCM(ctx context.Context, authorizationEntity string, creds GCMCrede
if err != nil {
return nil, errors.Wrap(err, "parse GCM register URL")
}
if errorCode := subscription.Get("Error"); errorCode != "" {
return nil, errors.Errorf("GCM registration failed: %s", errorCode)
} else if res.StatusCode != http.StatusOK {
return nil, errors.Errorf("GCM registration failed with HTTP %d", res.StatusCode)
}
token := subscription.Get("token")
if token == "" {
return nil, errors.New("GCM registration returned an empty token")
}

return &FCMCredentials{
GCM: creds,
Expand Down
Loading