mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
errdefs: remove "ErrAlreadyExists" because it's not an error
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 <github@gone.nl>
This commit is contained in:
committed by
Tibor Vass
parent
6cce52c245
commit
7d4b788381
@@ -89,19 +89,6 @@ func TestNotModified(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestAlreadyExists(t *testing.T) {
|
||||
if IsAlreadyExists(errTest) {
|
||||
t.Fatalf("did not expect already exists error, got %T", errTest)
|
||||
}
|
||||
e := AlreadyExists(errTest)
|
||||
if !IsAlreadyExists(e) {
|
||||
t.Fatalf("expected already exists error, got %T", e)
|
||||
}
|
||||
if cause := e.(causal).Cause(); cause != errTest {
|
||||
t.Fatalf("causual should be errTest, got: %v", cause)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUnauthorized(t *testing.T) {
|
||||
if IsUnauthorized(errTest) {
|
||||
t.Fatalf("did not expect unauthorized error, got %T", errTest)
|
||||
|
||||
Reference in New Issue
Block a user