diff options
author | Till <2353100+S7evinK@users.noreply.github.com> | 2022-09-07 11:44:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-07 11:44:27 +0200 |
commit | 440eb0f3a2e5aecddebe3e093d5740ce5c4505c2 (patch) | |
tree | 7d141e3fdbc7c53f314110ed00b6b6d39eeb7a98 /internal | |
parent | 847032df36086ff6f383bcc4c332c391e86eaec8 (diff) |
Handle errors differently in the `DeviceListUpdater` (#2695)
`If a device list update goes missing, the server resyncs on the next
one` was failing because a previous test would receive a `waitTime` of
1h, resulting in the test timing out.
This now tries to handle the returned errors differently, e.g. by using
the default `waitTime` of 2s. Also doesn't try further users in the
list, if one of the errors would cause a longer `waitTime`.
Diffstat (limited to 'internal')
-rw-r--r-- | internal/httputil/http.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/internal/httputil/http.go b/internal/httputil/http.go index 1e07ee33..ad26de51 100644 --- a/internal/httputil/http.go +++ b/internal/httputil/http.go @@ -24,7 +24,7 @@ import ( "net/url" "strings" - opentracing "github.com/opentracing/opentracing-go" + "github.com/opentracing/opentracing-go" "github.com/opentracing/opentracing-go/ext" ) @@ -81,8 +81,8 @@ func PostJSON[reqtype, restype any, errtype error]( return fmt.Errorf("HTTP %d from %s (no response body)", res.StatusCode, apiURL) } var reserr errtype - if err = json.Unmarshal(body, reserr); err != nil { - return fmt.Errorf("HTTP %d from %s", res.StatusCode, apiURL) + if err = json.Unmarshal(body, &reserr); err != nil { + return fmt.Errorf("HTTP %d from %s - %w", res.StatusCode, apiURL, err) } return reserr } |