浏览代码

Merge pull request #1323 from aboch/sbr

Return proper error types on sandbox creation
Madhu Venugopal 9 年之前
父节点
当前提交
68e53443c9
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      libnetwork/controller.go

+ 2 - 2
libnetwork/controller.go

@@ -806,7 +806,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
@@ -841,7 +841,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 {