Skip to content
This repository was archived by the owner on Jan 6, 2025. It is now read-only.

Commit 5fd48a7

Browse files
committed
Return error from NewClientWithAuth
Fixes #23
1 parent 3e0ede0 commit 5fd48a7

File tree

3 files changed

+3
-17
lines changed

3 files changed

+3
-17
lines changed

go.mod

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,4 @@ require (
99
google.golang.org/appengine v1.6.8 // indirect
1010
)
1111

12-
<<<<<<< HEAD
1312
require google.golang.org/protobuf v1.33.0 // indirect
14-
||||||| parent of 6a1969b (Update to Go 1.22.0)
15-
require google.golang.org/protobuf v1.31.0 // indirect
16-
=======
17-
require google.golang.org/protobuf v1.32.0 // indirect
18-
>>>>>>> 6a1969b (Update to Go 1.22.0)

go.sum

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,5 @@ google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAs
3939
google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds=
4040
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
4141
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
42-
<<<<<<< HEAD
4342
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
4443
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
45-
||||||| parent of 6a1969b (Update to Go 1.22.0)
46-
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
47-
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
48-
=======
49-
google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I=
50-
google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
51-
>>>>>>> 6a1969b (Update to Go 1.22.0)

miele/miele.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ type Client struct {
3333
}
3434

3535
// NewClientWithAuth returns a new Miele API client using the supplied credentials.
36-
func NewClientWithAuth(clientID, clientSecret, vg, username, password string) *Client {
36+
func NewClientWithAuth(clientID, clientSecret, vg, username, password string) (*Client, error) {
3737
conf := &oauth2.Config{
3838
ClientID: clientID,
3939
ClientSecret: clientSecret,
@@ -45,11 +45,11 @@ func NewClientWithAuth(clientID, clientSecret, vg, username, password string) *C
4545

4646
token, err := conf.PasswordCredentialsToken(ctx, username, password)
4747
if err != nil {
48-
log.Fatalf("error retrieving Miele token: %v", err)
48+
return nil, fmt.Errorf("error retrieving Miele token: %v", err)
4949
}
5050

5151
oauthClient := conf.Client(context.Background(), token)
52-
return NewClient(oauthClient)
52+
return NewClient(oauthClient), nil
5353
}
5454

5555
// NewClient returns a new Miele API client. If a nil httpClient is

0 commit comments

Comments
 (0)