Skip to content

Commit 720aa12

Browse files
committed
Return error if opening browser failed
1 parent e81543b commit 720aa12

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

oauth2/implicit_grant.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"net/http"
88
"strconv"
99
"time"
10+
"github.com/pkg/errors"
1011
)
1112

1213
type OAuthToken struct {
@@ -72,9 +73,13 @@ func OAuthImplicitGrantAuth(url, browserPath string, clientID uint, listenPort i
7273
authUrl := fmt.Sprintf("%s?client_id=%d&response_type=token", url, clientID)
7374

7475
if browserPath == "" {
75-
open.Start(authUrl)
76+
if err := open.Start(authUrl); err != nil {
77+
return OAuthToken{}, errors.Wrap(err, "opening browser error")
78+
}
7679
} else {
77-
open.StartWith(authUrl, browserPath)
80+
if err := open.StartWith(authUrl, browserPath); err != nil {
81+
return OAuthToken{}, errors.Wrap(err, "opening browser error")
82+
}
7883
}
7984

8085
token := <-tokenC

0 commit comments

Comments
 (0)