This commit is contained in:
aafetisov committed 2026-10-16 15:40:34 +03:00
1 parent 70edc100d5
commit 5825bdfa9e
65 files changed
+1061 -302

No files matched your search

+3 -4
View File
@@ -210,7 +210,7 @@ func (dc *DecortClient) getToken(ctx context.Context) error {
}
if resp.StatusCode != 200 {
return fmt.Errorf("cannot get token: %s", tokenBytes)
return newHTTPError("cannot get token", resp.StatusCode, tokenBytes)
}
// save token in config
@@ -297,8 +297,7 @@ func (dc *DecortClient) do(req *http.Request, ctype string) ([]byte, error) {
}
// handle errors with status code other than 200
err = fmt.Errorf("%s", respBytes)
return nil, fmt.Errorf("could not execute request: %w", err)
return nil, newHTTPError("could not execute request", resp.StatusCode, respBytes)
}
// isConnectionError checks if given error falls within specific and associated connection errors
@@ -444,7 +443,7 @@ func getTokenExp(token string) (time.Time, error) {
exp, ok := claims["exp"]
if !ok {
return time.Time{}, fmt.Errorf("exp time bot found")
return time.Time{}, fmt.Errorf("exp time not found")
}
expTime := time.Unix(int64(exp.(float64)), 0)