From 07d82d111af221334f799497d0946a0af943c8bb Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Wed, 20 May 2020 13:12:22 -0400 Subject: Print container state when erroring that it is improper This is a nice little convenience - lets people know why we won't let them attach to a container. Signed-off-by: Matthew Heon --- pkg/api/handlers/compat/containers_attach.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pkg/api/handlers/compat') diff --git a/pkg/api/handlers/compat/containers_attach.go b/pkg/api/handlers/compat/containers_attach.go index 5fc3117b9..012e20daf 100644 --- a/pkg/api/handlers/compat/containers_attach.go +++ b/pkg/api/handlers/compat/containers_attach.go @@ -94,7 +94,7 @@ func AttachContainer(w http.ResponseWriter, r *http.Request) { return } } else if !(state == define.ContainerStateCreated || state == define.ContainerStateRunning) { - utils.InternalServerError(w, errors.Wrapf(define.ErrCtrStateInvalid, "can only attach to created or running containers")) + utils.InternalServerError(w, errors.Wrapf(define.ErrCtrStateInvalid, "can only attach to created or running containers - currently in state %s", state.String())) return } -- cgit v1.2.3-54-g00ecf