Skip to content
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

Merged
merged 1 commit into from
May 21, 2018

Conversation

AntaresS
Copy link
Contributor

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 message Error: No such object: FooBar. However it returns Error 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

@@ -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)) {
Copy link
Collaborator

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

Copy link
Contributor Author

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>

func isErrSkippable(err error) bool {
return apiclient.IsErrNotFound(err) ||
strings.Contains(err.Error(), "not supported") ||
Copy link
Member

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)

Copy link
Collaborator

@tiborvass tiborvass left a comment

Choose a reason for hiding this comment

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

LGTM

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

@thaJeztah thaJeztah merged commit 26123be into docker:master May 21, 2018
@GordonTheTurtle GordonTheTurtle added this to the 18.06.0 milestone May 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants