Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: read admin api response body from error #6244

Merged
merged 2 commits into from
Jun 26, 2024
Merged

Conversation

czeslavo
Copy link
Contributor

What this PR does / why we need it:

Don't rely on ReloadDeclarativeRawConfig to return the error body when err != nil as it might be considered a Go anti-pattern to use variables when an error is returned. Instead, rely on the APIError being returned in cases where the error body is available.

Which issue this PR fixes:

Follow up to #6237 (comment).

@czeslavo czeslavo self-assigned this Jun 25, 2024
@czeslavo czeslavo marked this pull request as ready for review June 25, 2024 13:52
@czeslavo czeslavo requested a review from a team as a code owner June 25, 2024 13:52
programmer04
programmer04 previously approved these changes Jun 25, 2024
Copy link
Member

@programmer04 programmer04 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🏅
So the next step is to just return only a particular error or nil from ReloadDeclarativeRawConfig? 🤔

@czeslavo
Copy link
Contributor Author

Well, given we haven't released go-kong v1 yet, we can release a breaking change I believe 🤔 Kong/go-kong#453.

Let's hold on with merging this PR and release go-kong first so it's done in a single step.

@czeslavo czeslavo added the do not merge let the author merge this, don't merge for them. label Jun 25, 2024
@programmer04 programmer04 self-requested a review June 25, 2024 16:10
@czeslavo czeslavo removed the do not merge let the author merge this, don't merge for them. label Jun 25, 2024
Copy link

codecov bot commented Jun 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (main@420b44c). Learn more about missing BASE report.
Report is 1 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff           @@
##             main   #6244   +/-   ##
======================================
  Coverage        ?   73.6%           
======================================
  Files           ?     200           
  Lines           ?   19912           
  Branches        ?       0           
======================================
  Hits            ?   14673           
  Misses          ?    4253           
  Partials        ?     986           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@programmer04 programmer04 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🏆

@czeslavo czeslavo merged commit 3e5600c into main Jun 26, 2024
40 of 41 checks passed
@czeslavo czeslavo deleted the chore/discard-errbody branch June 26, 2024 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants