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

[18.09 backport] Include old error-message for backward compatibility #2801

Merged

Conversation

thaJeztah
Copy link
Member

Backport of #2797 for 18.09

cherry-pick was clean

Commit 2061af7 (#2779) 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

- Description for the changelog

- Include old error-message for backward compatibility [docker/swarmkit#2797](https://github.com/docker/swarmkit/pull/2797)

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
Member Author

@wsong @seemethere @dperny

@codecov
Copy link

codecov bot commented Jan 7, 2019

Codecov Report

Merging #2801 into bump_v18.09 will decrease coverage by <.01%.
The diff coverage is 100%.

@@               Coverage Diff               @@
##           bump_v18.09    #2801      +/-   ##
===============================================
- Coverage        61.87%   61.87%   -0.01%     
===============================================
  Files              134      134              
  Lines            21868    21868              
===============================================
- Hits             13531    13530       -1     
- Misses            6883     6884       +1     
  Partials          1454     1454

@dperny
Copy link
Collaborator

dperny commented Jan 7, 2019

LGTM

@dperny dperny merged commit 19a6d36 into moby:bump_v18.09 Jan 7, 2019
@thaJeztah thaJeztah deleted the 18.09_backport_change_error_message branch January 7, 2019 18:02
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.

3 participants