diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-07-20 16:07:13 +0200 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-07-20 16:07:13 +0200 |
| commit | 0c9a300a58d9dacce7b84ff93222eed35eab5721 (patch) | |
| tree | 423d1f05024f5c050e09f8d239f15b2e8681e640 /internal/server/api.go | |
| parent | a1939a105dc4ddab27489b1bac3b22f674536e41 (diff) | |
Refactor: Do not log in internal packages
The reason behind this is that we then do not have to pass a lot to
each function. Logging inside internal packages is less useful as we
want to let them return errors and only log in the 'public' facing API
or let the client decide
Diffstat (limited to 'internal/server/api.go')
| -rw-r--r-- | internal/server/api.go | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/internal/server/api.go b/internal/server/api.go index c8c7180..a3d8e31 100644 --- a/internal/server/api.go +++ b/internal/server/api.go @@ -8,7 +8,6 @@ import ( "net/url" httpw "github.com/jwijenbergh/eduvpn-common/internal/http" - "github.com/jwijenbergh/eduvpn-common/internal/log" "github.com/jwijenbergh/eduvpn-common/internal/types" "github.com/jwijenbergh/eduvpn-common/internal/util" ) @@ -70,17 +69,12 @@ func apiAuthorized(server Server, method string, endpoint string, opts *httpw.HT func apiAuthorizedRetry(server Server, method string, endpoint string, opts *httpw.HTTPOptionalParams) (http.Header, []byte, error) { errorMessage := "failed authorized API retry" header, body, bodyErr := apiAuthorized(server, method, endpoint, opts) - base, baseErr := server.GetBase() - if baseErr != nil { - return nil, nil, &types.WrappedErrorMessage{Message: errorMessage, Err: baseErr} - } if bodyErr != nil { var error *httpw.HTTPStatusError // Only retry authorized if we get a HTTP 401 if errors.As(bodyErr, &error) && error.Status == 401 { - base.Logger.Log(log.LOG_INFO, fmt.Sprintf("API: Got HTTP error %v, retrying authorized", error)) // Tell the method that the token is expired server.GetOAuth().Token.ExpiredTimestamp = util.GenerateTimeSeconds() retryHeader, retryBody, retryErr := apiAuthorized(server, method, endpoint, opts) |
