8000 client: Use containerd errdefs to convert http errors by vvoland · Pull Request #50030 · moby/moby · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

client: Use containerd errdefs to convert http errors #50030

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 1 commit into from
May 21, 2025

Conversation

vvoland
Copy link
Contributor
@vvoland vvoland commented May 19, 2025

Previously, we were using our own FromStatusCode function to map HTTP status codes to Docker error types. Switch to the containerd code.

errdefs: Deprecate `errdefs.FromStatusCode`. Use containerd's `errhttp.ToNative` instead.

- A picture of a cute animal (not mandatory but encouraged)

@vvoland vvoland added this to the 28.2.0 milestone May 19, 2025
@vvoland vvoland self-assigned this May 19, 2025
@vvoland vvoland added impact/deprecation area/go-sdk Changes affecting the Go SDK labels May 19, 2025
@thaJeztah
Copy link
Member

@vvoland this one can be rebased

@@ -5,6 +5,8 @@ import (
)

// FromStatusCode creates an errdef error, based on the provided HTTP status-code
//
// Deprecated: Use [cerrdefs.ToNative] instead
func FromStatusCode(err error, statusCode int) error {
Copy link
Member

Choose a reason for hiding this comment

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

Can we make this wrap httpErrorFromStatusCode? That way the test would also cover that the behavior is un-modified.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That would require moving it out of client to a shared package though. Possibly under internal, but that would make the errdefs depending on the internal.. (although that might not be such a big deal if it's going away?)

Copy link
Member

Choose a reason for hiding this comment

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

oh! my mistake; I glanced over after I commented, and thought they were in the same package 😞

Previously, we were using our own `FromStatusCode` function to map HTTP
status codes to Docker error types. Switch to the containerd code.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
@vvoland vvoland marked this pull request as ready for review May 21, 2025 09:41
Copy link
Member
@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

@vvoland vvoland merged commit 894244c into moby:master May 21, 2025
144 checks passed
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
0