-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
fix error message from docker inspect #1071
Conversation
4c0b996
to
10c9014
Compare
cli/command/system/inspect.go
Outdated
@@ -201,7 +197,7 @@ func inspectAll(ctx context.Context, dockerCli *command.DockerCli, getSize bool, | |||
} | |||
v, raw, err := inspectData.objectInspector(ref) | |||
if err != nil { | |||
if typeConstraint == "" && (apiclient.IsErrNotFound(err) || isErrNotSupported(err)) { | |||
if typeConstraint == "" && (apiclient.IsErrNotFound(err) || isErrorSkippable(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.
you might as well put IsErrNotFound
into isErrorSkippable
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.
@tiborvass done
Signed-off-by: Anda Xu <anda.xu@docker.com>
10c9014
to
d209043
Compare
|
||
func isErrSkippable(err error) bool { | ||
return apiclient.IsErrNotFound(err) || | ||
strings.Contains(err.Error(), "not supported") || |
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.
Wondering if this was actually checking for a "not implemented" error; https://github.com/moby/moby/blob/3a633a712c8bbb863fe7e57ec132dd87a9c4eff7/client/errors.go#L121
(not for this PR, but we should look at that)
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
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
Signed-off-by: Anda Xu anda.xu@docker.com
- What I did
Fix docker inspect error message on invalid reference format to return generic message
Error: No such object:
- How I did it
add error message checking
- How to verify it
- Description for the changelog
When
docker inspect FooBar
, it is supposed to return the error messageError: No such object: FooBar
. However it returnsError response from daemon: no such image: FooBar: invalid reference format: repository name must be lowercase
instead. After the fix, it should return the former message.- A picture of a cute animal (not mandatory but encouraged)
cc @thaJeztah @tiborvass