diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2023-02-17 10:35:27 +0100 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2023-02-17 10:35:27 +0100 |
| commit | b05ce93edfeb86ddd7af5a859eb5e20b3653e56b (patch) | |
| tree | 163c8d01e96be782eaa9b066639de34e4e03f981 /internal/oauth/oauth.go | |
| parent | 354706c76e0531a282d1ee904ec5a0640ab34627 (diff) | |
Refactor: Improve some errors by using errors.New and add context
Diffstat (limited to 'internal/oauth/oauth.go')
| -rw-r--r-- | internal/oauth/oauth.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/internal/oauth/oauth.go b/internal/oauth/oauth.go index 6b42bc2..cb060c4 100644 --- a/internal/oauth/oauth.go +++ b/internal/oauth/oauth.go @@ -153,7 +153,7 @@ func (oauth *OAuth) setupListener() error { // If it was unsuccessful it returns an error. func (oauth *OAuth) tokensWithCallback() error { if oauth.session.Listener == nil { - return errors.Errorf("failed getting tokens with callback: no listener") + return errors.New("failed getting tokens with callback: no listener") } mux := http.NewServeMux() // server /callback over the listener address @@ -434,7 +434,7 @@ func (oauth *OAuth) Init(iss string, baseAuthorizationURL string, tokenURL strin // It returns the port as an integer and an error if there is any. func (oauth *OAuth) ListenerPort() (int, error) { if oauth.session.Listener == nil { - return 0, errors.Errorf("failed to get listener port") + return 0, errors.New("failed to get listener port") } return oauth.session.Listener.Addr().(*net.TCPAddr).Port, nil } |
