Skip to content

[RFC] errdefs: remove "ErrAlreadyExists" because it's not an error#38462

Merged
tiborvass merged 1 commit intomoby:masterfrom
thaJeztah:remove_non_error_from_errdefs
Mar 22, 2019
Merged

[RFC] errdefs: remove "ErrAlreadyExists" because it's not an error#38462
tiborvass merged 1 commit intomoby:masterfrom
thaJeztah:remove_non_error_from_errdefs

Conversation

@thaJeztah
Copy link
Member

The ErrAlreadyExists error is used for 304 statuses, which is not an error-condition, so should probably not be defined as part of the errdefs package.

This patch removes the ErrAlreadyExists interface, and related helpers, as it was currently not used.

Note that a 304 status can fulfil certain use-cases, but (refering to https://www.codetinkerer.com/2015/12/04/choosing-an-http-status-code.html) could probably be handled by a 200 OK, unless we want to perform caching in the client.

If we do want to use 304 statuses, perhaps we need a separate class of "errors" for this (?).

@thaJeztah
Copy link
Member Author

thaJeztah commented Dec 31, 2018

@cpuguy83 mainly opening this for discussion, as we're not using this one currently, so perhaps we should remove, and re-implement if we need this?

IIUC, a 304 should generally be returned for a GET or HEAD, but not for a POST / PUT

Copy link
Member Author

Choose a reason for hiding this comment

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

This seemed incorrect at least

@cpuguy83
Copy link
Member

cpuguy83 commented Jan 2, 2019

Since it is not currently being used I guess it's ok to remove...

Note that errdefs is not about 1-1 mapping to HTTP status codes, but rather to help calling code to understand the error that was returned.

@tiborvass
Copy link
Contributor

TestSwarmClusterRotateUnlockKey is flakey

@thaJeztah
Copy link
Member Author

Yup; #33041

The `ErrAlreadyExists` error is used for 304 statuses, which
is not an error-condition, so should probably not be defined
as part of the errdefs package.

This patch removes the `ErrAlreadyExists` interface, and related
helpers, as it was currently not used.

Note that a 304 status can fulfil certain use-cases, but (refering
to https://www.codetinkerer.com/2015/12/04/choosing-an-http-status-code.html)
could probably be handled by a 200 OK, unless we want to perform
caching in the client.

If we do want to use 304 statuses, perhaps we need a separate class
of "errors" for this (?).

Signed-off-by: Sebastiaan van Stijn <[email protected]>
@tiborvass tiborvass force-pushed the remove_non_error_from_errdefs branch from 99c49a8 to 7d4b788 Compare March 21, 2019 21:25
@codecov
Copy link

codecov bot commented Mar 21, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@6cce52c). Click here to learn what that means.
The diff coverage is 0%.

@@            Coverage Diff            @@
##             master   #38462   +/-   ##
=========================================
  Coverage          ?   36.89%           
=========================================
  Files             ?      614           
  Lines             ?    45383           
  Branches          ?        0           
=========================================
  Hits              ?    16743           
  Misses            ?    26348           
  Partials          ?     2292

@tiborvass tiborvass merged commit 2101a83 into moby:master Mar 22, 2019
@thaJeztah thaJeztah deleted the remove_non_error_from_errdefs branch March 22, 2019 00:20
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.

6 participants