Skip to content

refactor: replace Code by Detail in the http API error #1011

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

Merged
merged 5 commits into from
Apr 18, 2022

Conversation

BrunoQuaresma
Copy link
Collaborator

Closes #1008

@BrunoQuaresma BrunoQuaresma self-assigned this Apr 14, 2022
@BrunoQuaresma
Copy link
Collaborator Author

Should we create a function to centralize these messages?

@codecov
Copy link

codecov bot commented Apr 14, 2022

Codecov Report

Merging #1011 (35f9f18) into main (76f8ff9) will increase coverage by 0.02%.
The diff coverage is 93.33%.

@@            Coverage Diff             @@
##             main    #1011      +/-   ##
==========================================
+ Coverage   67.08%   67.10%   +0.02%     
==========================================
  Files         256      256              
  Lines       14986    14986              
  Branches      136      136              
==========================================
+ Hits        10053    10056       +3     
+ Misses       3938     3935       -3     
  Partials      995      995              
Flag Coverage Δ
unittest-go-macos-latest 53.57% <93.33%> (-0.14%) ⬇️
unittest-go-postgres- 66.76% <93.33%> (+0.05%) ⬆️
unittest-go-ubuntu-latest 56.12% <93.33%> (-0.21%) ⬇️
unittest-go-windows-2022 53.03% <93.33%> (+0.02%) ⬆️
unittest-js 62.94% <ø> (ø)
Impacted Files Coverage Δ
codersdk/client.go 59.74% <0.00%> (ø)
coderd/httpapi/httpapi.go 72.50% <100.00%> (ø)
coderd/organizations.go 60.64% <100.00%> (ø)
coderd/users.go 59.60% <100.00%> (ø)
coderd/workspaces.go 55.62% <100.00%> (ø)
coderd/parameter/compute.go 74.07% <0.00%> (-6.67%) ⬇️
provisionerd/provisionerd.go 82.35% <0.00%> (-0.45%) ⬇️
coderd/database/queries.sql.go 83.65% <0.00%> (-0.42%) ⬇️
coderd/provisionerdaemons.go 63.97% <0.00%> (+0.51%) ⬆️
peer/conn.go 82.23% <0.00%> (+1.77%) ⬆️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 76f8ff9...35f9f18. Read the comment docs.

BrunoQuaresma and others added 3 commits April 14, 2022 16:35
Co-authored-by: G r e y <grey@coder.com>
…der/coder into bq/1008/replace-code-by-detail
Copy link
Contributor

@greyscaled greyscaled left a comment

Choose a reason for hiding this comment

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

This looks good to me, but we should get approval from @coder/backend

@greyscaled greyscaled requested a review from a team April 15, 2022 19:01
Copy link
Member

@johnstcn johnstcn left a comment

Choose a reason for hiding this comment

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

As far as I know, the idea of the Code field is to allow a machine-readable error message.
Should we maybe keep both Code and Detail fields instead?

@kylecarbs
Copy link
Member

The idea short-term is to try eliminating machine-readable messages in favor of HTTP response codes. If that doesn't work, we'll probably have to do something like that.

@BrunoQuaresma BrunoQuaresma merged commit 3311c2f into main Apr 18, 2022
@BrunoQuaresma BrunoQuaresma deleted the bq/1008/replace-code-by-detail branch April 18, 2022 16:02
@misskniss misskniss added this to the V2 Beta milestone May 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor: Exchange code for detail in API Error Responses
5 participants