From 2e88dfa4062e777c9dec28cfbb8258250dbba3eb Mon Sep 17 00:00:00 2001 From: Alessandro Boch Date: Tue, 12 Jul 2016 21:02:10 -0700 Subject: [PATCH] Return proper error types on sandbox creation Signed-off-by: Alessandro Boch --- libnetwork/controller.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libnetwork/controller.go b/libnetwork/controller.go index 216f7ccd10..da12540b96 100644 --- a/libnetwork/controller.go +++ b/libnetwork/controller.go @@ -801,7 +801,7 @@ func (c *controller) NewSandbox(containerID string, options ...SandboxOption) (s // If not a stub, then we already have a complete sandbox. if !s.isStub { c.Unlock() - return nil, types.BadRequestErrorf("container %s is already present: %v", containerID, s) + return nil, types.ForbiddenErrorf("container %s is already present: %v", containerID, s) } // We already have a stub sandbox from the @@ -836,7 +836,7 @@ func (c *controller) NewSandbox(containerID string, options ...SandboxOption) (s c.Lock() if sb.ingress && c.ingressSandbox != nil { c.Unlock() - return nil, fmt.Errorf("ingress sandbox already present") + return nil, types.ForbiddenErrorf("ingress sandbox already present") } if sb.ingress {