summaryrefslogtreecommitdiff
path: root/api
diff options
context:
space:
mode:
authorSebastiaan van Stijn <github@gone.nl>2023-04-08 19:30:33 +0200
committerSebastiaan van Stijn <github@gone.nl>2023-04-08 19:30:33 +0200
commit81e62af94ac59cf56aa6f988e04f5238e0f69ad1 (patch)
treebfebbdf0b74129c0e50145fde2de28dfba97370d /api
parentdd3b71d17c614f837c4bba18baed9fa2cb31f1a4 (diff)
downloaddocker-81e62af94ac59cf56aa6f988e04f5238e0f69ad1.tar.gz
use consistent alias for containerd's errdefs package
The signatures of functions in containerd's errdefs packages are very similar to those in our own, and it's easy to accidentally use the wrong package. This patch uses a consistent alias for all occurrences of this import. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Diffstat (limited to 'api')
-rw-r--r--api/server/httpstatus/status.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/api/server/httpstatus/status.go b/api/server/httpstatus/status.go
index f6a8816032..651e301dc1 100644
--- a/api/server/httpstatus/status.go
+++ b/api/server/httpstatus/status.go
@@ -4,7 +4,7 @@ import (
"fmt"
"net/http"
- containerderrors "github.com/containerd/containerd/errdefs"
+ cerrdefs "github.com/containerd/containerd/errdefs"
"github.com/docker/distribution/registry/api/errcode"
"github.com/docker/docker/errdefs"
"github.com/sirupsen/logrus"
@@ -132,17 +132,17 @@ func statusCodeFromDistributionError(err error) int {
// consumed directly (not through gRPC)
func statusCodeFromContainerdError(err error) int {
switch {
- case containerderrors.IsInvalidArgument(err):
+ case cerrdefs.IsInvalidArgument(err):
return http.StatusBadRequest
- case containerderrors.IsNotFound(err):
+ case cerrdefs.IsNotFound(err):
return http.StatusNotFound
- case containerderrors.IsAlreadyExists(err):
+ case cerrdefs.IsAlreadyExists(err):
return http.StatusConflict
- case containerderrors.IsFailedPrecondition(err):
+ case cerrdefs.IsFailedPrecondition(err):
return http.StatusPreconditionFailed
- case containerderrors.IsUnavailable(err):
+ case cerrdefs.IsUnavailable(err):
return http.StatusServiceUnavailable
- case containerderrors.IsNotImplemented(err):
+ case cerrdefs.IsNotImplemented(err):
return http.StatusNotImplemented
default:
return http.StatusInternalServerError