-
Notifications
You must be signed in to change notification settings - Fork 18.9k
errdefs: move GetHTTPErrorStatusCode to api/server/httpstatus #43399
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
errdefs: move GetHTTPErrorStatusCode to api/server/httpstatus #43399
Conversation
462da2c to
47f778d
Compare
This reverts the changes made in 2a9c987, which moved the GetHTTPErrorStatusCode() utility to the errdefs package. While it seemed to make sense at the time to have the errdefs package provide conversion both from HTTP status codes errdefs and the reverse, a side-effect of the move was that the errdefs package now had a dependency on various external modules, to handle conversio of errors coming from those sub-systems, such as; - github.com/containerd/containerd - github.com/docker/distribution - google.golang.org/grpc This patch moves the conversion from (errdef-) errors to HTTP status-codes to a api/server/httpstatus package, which is only used by the API server, and should not be needed by client-code using the errdefs package. The MakeErrorHandler() utility was moved to the API server itself, as that's the only place it's used. While the same applies to the GetHTTPErrorStatusCode func, I opted for keeping that in its own package for a slightly cleaner interface. Why not move it into the api/server/httputils package? The api/server/httputils package is also imported in the client package, which uses the httputils.ParseForm() and httputils.HijackConnection() functions as part of the TestTLSCloseWriter() test. While this is only used in tests, I wanted to avoid introducing the indirect depdencencies outside of the api/server code. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
47f778d to
e82b7b2
Compare
|
LGTM thanks @thaJeztah |
|
Thanks for reviewing, @dims! @cpuguy83 @ndeloof @rumpl PTAL Failure is unrelated (known flaky test); #39352 I'll kick CI again; |
|
✅ all green now 👍 |
cpuguy83
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
rumpl
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
|
Gonna take a plunge and bring this one in 👍. Thanks for review, everyone! |
|
thanks a ton @thaJeztah |
relates to:
This reverts the changes made in 2a9c987 (#42623),
which moved the GetHTTPErrorStatusCode() utility to the errdefs package.
While it seemed to make sense at the time to have the errdefs package provide
conversion both from HTTP status codes errdefs and the reverse, a side-effect
of the move was that the errdefs package now had a dependency on various external
modules, to handle conversio of errors coming from those sub-systems, such as;
This patch moves the conversion from (errdef-) errors to HTTP status-codes to a
api/server/httpstatus package, which is only used by the API server, and should
not be needed by client-code using the errdefs package.
The MakeErrorHandler() utility was moved to the API server itself, as that's the
only place it's used. While the same applies to the GetHTTPErrorStatusCode func,
I opted for keeping that in its own package for a slightly cleaner interface.
Why not move it into the api/server/httputils package?
The api/server/httputils package is also imported in the client package, which
uses the httputils.ParseForm() and httputils.HijackConnection() functions as
part of the TestTLSCloseWriter() test. While this is only used in tests, I
wanted to avoid introducing the indirect depdencencies outside of the api/server
code.
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)