diff options
author | feistel <6742251-feistel@users.noreply.gitlab.com> | 2021-08-09 16:21:23 +0300 |
---|---|---|
committer | feistel <6742251-feistel@users.noreply.gitlab.com> | 2021-08-09 16:21:23 +0300 |
commit | 990eb1fc3f49f265d60172e85aaabe2deffe66c5 (patch) | |
tree | abd42c80770649e9041f9147db2a12142300b412 /internal/auth/auth.go | |
parent | 27626cd8ddcd9cd8ff2046f306d88d4c78648eb1 (diff) |
feat: capture errors when trying to fetch the access token
Diffstat (limited to 'internal/auth/auth.go')
-rw-r--r-- | internal/auth/auth.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/internal/auth/auth.go b/internal/auth/auth.go index daab3c8c..d4298702 100644 --- a/internal/auth/auth.go +++ b/internal/auth/auth.go @@ -510,6 +510,7 @@ func (a *Auth) checkAuthentication(w http.ResponseWriter, r *http.Request, domai if err != nil { logRequest(r).WithError(err).Error("Failed to retrieve info with token") + errortracking.Capture(err) // call serve404 handler when auth fails domain.ServeNotFoundAuthFailed(w, r) return true @@ -521,9 +522,10 @@ func (a *Auth) checkAuthentication(w http.ResponseWriter, r *http.Request, domai return true } - if resp.StatusCode != 200 { + if resp.StatusCode != http.StatusOK { // call serve404 handler when auth fails logRequest(r).WithField("status", resp.Status).Error("Unexpected response fetching access token") + errortracking.Capture(fmt.Errorf("unexpected response fetching access token status: %d", resp.StatusCode)) domain.ServeNotFoundAuthFailed(w, r) return true } |