Skip to content

Commit

Permalink
rename error
Browse files Browse the repository at this point in the history
  • Loading branch information
jooola committed Jun 24, 2024
1 parent d545335 commit d3a70cf
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions hcloud/client_handler_error.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/hetznercloud/hcloud-go/v2/hcloud/schema"
)

var ErrorStatusCode = errors.New("server responded with status code")
var ErrStatusCode = errors.New("server responded with status code")

func wrapErrorHandler(wrapped handler) handler {
return &errorHandler{wrapped}
Expand All @@ -28,7 +28,7 @@ func (h *errorHandler) Do(req *http.Request, v any) (resp *Response, err error)
if resp.StatusCode >= 400 && resp.StatusCode <= 599 {
err = errorFromBody(resp)
if err == nil {
err = fmt.Errorf("hcloud: %w %d", ErrorStatusCode, resp.StatusCode)
err = fmt.Errorf("hcloud: %w %d", ErrStatusCode, resp.StatusCode)
}
}
return resp, err
Expand Down
2 changes: 1 addition & 1 deletion hcloud/client_handler_retry.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func retryPolicy(resp *Response, err error) bool {
if apiErr.Code == ErrorCodeConflict {
return true
}
case errors.Is(err, ErrorStatusCode):
case errors.Is(err, ErrStatusCode):
if resp == nil || resp.Response == nil {
// Should not happen
return false
Expand Down
2 changes: 1 addition & 1 deletion hcloud/client_handler_retry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func TestRetryHandler(t *testing.T) {
wrapped: func(req *http.Request, _ any) (*Response, error) {
resp := fakeResponse(t, 503, "", false)
resp.Response.Request = req
return resp, fmt.Errorf("%w %d", ErrorStatusCode, 503)
return resp, fmt.Errorf("%w %d", ErrStatusCode, 503)
},
want: 1,
},
Expand Down

0 comments on commit d3a70cf

Please sign in to comment.