X Tutup
Skip to content

fix error message from docker inspect#1071

Merged
thaJeztah merged 1 commit intodocker:masterfrom
AntaresS:fix-inspect-error
May 21, 2018
Merged

fix error message from docker inspect#1071
thaJeztah merged 1 commit intodocker:masterfrom
AntaresS:fix-inspect-error

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

@AntaresS AntaresS force-pushed the fix-inspect-error branch 2 times, most recently from 4c0b996 to 10c9014 Compare May 21, 2018 18:21
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>
@AntaresS AntaresS force-pushed the fix-inspect-error branch from 10c9014 to d209043 Compare May 21, 2018 18:32

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.

4 participants

X Tutup