-
Notifications
You must be signed in to change notification settings - Fork 18.8k
client: use containerd errdefs checks #50019
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
Conversation
- needs: client: Use gotest.tools style assertions #50018
b23ea21
to
0cc4fcf
Compare
🙈 needs a rebase |
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
0cc4fcf
to
e655763
Compare
Did a quick rebase; mostly adjacent lines due to #50027 being merged. |
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
return "", errdefs.InvalidParameter(fmt.Errorf("invalid platform: %v", err)) | ||
return "", fmt.Errorf("%w: invalid platform: %v", cerrdefs.ErrInvalidArgument, err) |
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.
Fine for now, but wondering if containerd/errdefs has a good way to type the error without that meaning that the literal invalid argument
is part of the message 🤔
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.
I guess something like;
return "", errdefs.InvalidParameter(fmt.Errorf("invalid platform: %v", err)) | |
return "", fmt.Errorf("%w: invalid platform: %v", cerrdefs.ErrInvalidArgument, err) | |
return "", cerrdefs.ErrInvalidArgument.WithMessage(fmt.Sprint("invalid platform: %v", err)) |
But that would discard the underlying error (which would be fine for this case, but perhaps not for others 🤔
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.
WithMessage
is useful if you "need" a specific message, I would say "invalid argument: invalid platform" would be fine as it goes to more specific still. To keep the original error, multiple %w
can be provided as well.
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.
Yeah, it's just that in many cases, adding the literal some-error-type
to the message is just noise; at least for the user (these tend to be printed / presented to the user). Where it's relevant to us to determine the error type for code flow, ideally that implementation detail shouldn't have to make its way to the user.
e.g. want to avoid things like;
failed to create container: invalid-argument: network some-network was not found: not-found