fix[#285]: change APIError to use pointer receiver#298
Conversation
Allows APIError to be used as expected with `errors.As`
Codecov ReportBase: 40.84% // Head: 40.87% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #298 +/- ##
==========================================
+ Coverage 40.84% 40.87% +0.02%
==========================================
Files 46 46
Lines 2661 2662 +1
==========================================
+ Hits 1087 1088 +1
Misses 1485 1485
Partials 89 89
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
| retry, err := apierr.CheckForRetry(ctx, response, err, responseBody.Bytes(), responseBodyErr) | ||
| if err != nil && !errors.As(err, &apierr.APIError{}) { | ||
| var apiErr *apierr.APIError | ||
| if err != nil && !errors.As(err, &apiErr) { |
There was a problem hiding this comment.
This now takes a pointer to a pointer. I don't understand why this is necessary.
There was a problem hiding this comment.
I'll take a look at the linked issue first.
There was a problem hiding this comment.
I see the linked documentation that shows defining a pointer type prior to calling errors.As.
LGTM, thanks for the PR!
* Change APIError to use pointer receiver ([#298](#298)). * Drop duplicate prefix in randomized email ([#299](#299)). * Expand semver pattern to be compliant with https://semver.org ([#302](#302)). * Fix `apierr.APIError` pointer receivers ([#307](#307)). * Skip loading config if auth is already explicitly configured directly ([#306](#306)). * Sync fixes for smallest node selection from Terraform ([#301](#301)). * Updated from OpenAPI spec ([#305](#305)). Dependency updates: * Bump google.golang.org/api from 0.109.0 to 0.110.0 ([#303](#303)).
* Change APIError to use pointer receiver ([#298](#298)). * Drop duplicate prefix in randomized email ([#299](#299)). * Expand semver pattern to be compliant with https://semver.org ([#302](#302)). * Fix `apierr.APIError` pointer receivers ([#307](#307)). * Skip loading config if auth is already explicitly configured directly ([#306](#306)). * Sync fixes for smallest node selection from Terraform ([#301](#301)). * Updated from OpenAPI spec ([#305](#305)). Dependency updates: * Bump google.golang.org/api from 0.109.0 to 0.110.0 ([#303](#303)).
Allows APIError to be used as expected with
errors.As. Closes #285.