Skip to content

[18.03 backport] fix api error types#2787

Closed
thaJeztah wants to merge 4 commits into
moby:bump_v18.03from
thaJeztah:18.03_backport_fix_api_error_types
Closed

[18.03 backport] fix api error types#2787
thaJeztah wants to merge 4 commits into
moby:bump_v18.03from
thaJeztah:18.03_backport_fix_api_error_types

Conversation

@thaJeztah
Copy link
Copy Markdown
Member

@thaJeztah thaJeztah commented Nov 21, 2018

backport of #2779 and #2797 for 18.03

this PR was built on top of #2786 to get a clean cherry-pick

git checkout -b 18.03_backport_fix_api_error_types upstream/bump_v18.03
git cherry-pick -s -S -x 2061af766f61f6bc8d3e43d5553fba315f569597
git cherry-pick -s -S -x 2bbdeec8998b3fd400ed8d892e87ed1d8935e105
git push -u origin

cherry-pick was clean; no conflict

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 2dfbafc)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit cb6dcf2)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 2061af7)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Commit 2061af7 fixed the API
returning incorrect status-codes, but also changed the error
message for conflicting service-names to be in line with other
objects (secrets, configs); "service XX already exists".

Unfortunately, there are existing consumers of the API that
perform string-matching, and changing the error-message resulted
in a breaking change.

This patch prepends the `ErrNameConflict` error-message to the
error-message, so that those consumers still find the original
message, but preserves the enhancement made in 2061af7 (inclusion
of the conflicting service name).

With this patch applied, the error message will look like this;

    name conflicts with an existing object: service myservice already exists

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 2bbdeec)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah
Copy link
Copy Markdown
Member Author

closing this, as 18.03 is EOL

@thaJeztah thaJeztah closed this Nov 4, 2020
@thaJeztah thaJeztah deleted the 18.03_backport_fix_api_error_types branch November 4, 2020 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant