Merge pull request #18965 from duglin/FixError

Fix error messages
This commit is contained in:
David Calavera 2015-12-29 14:12:22 -08:00
commit acffc79fe4
2 changed files with 5 additions and 4 deletions

View File

@ -224,7 +224,7 @@ func (s *containerRouter) postContainersKill(ctx context.Context, w http.Respons
// to keep backwards compatibility. // to keep backwards compatibility.
version := httputils.VersionFromContext(ctx) version := httputils.VersionFromContext(ctx)
if version.GreaterThanOrEqualTo("1.20") || !isStopped { if version.GreaterThanOrEqualTo("1.20") || !isStopped {
return fmt.Errorf("Cannot kill container %s: %v", name, err) return fmt.Errorf("Cannot kill container %s: %v", name, utils.GetErrorMessage(err))
} }
} }
@ -462,7 +462,7 @@ func (s *containerRouter) wsContainersAttach(ctx context.Context, w http.Respons
} }
if err := s.backend.ContainerWsAttachWithLogs(containerName, wsAttachWithLogsConfig); err != nil { if err := s.backend.ContainerWsAttachWithLogs(containerName, wsAttachWithLogsConfig); err != nil {
logrus.Errorf("Error attaching websocket: %s", err) logrus.Errorf("Error attaching websocket: %s", utils.GetErrorMessage(err))
} }
}) })
ws := websocket.Server{Handler: h, Handshake: nil} ws := websocket.Server{Handler: h, Handshake: nil}

View File

@ -11,6 +11,7 @@ import (
"github.com/docker/docker/api/server/httputils" "github.com/docker/docker/api/server/httputils"
"github.com/docker/docker/api/types" "github.com/docker/docker/api/types"
"github.com/docker/docker/pkg/stdcopy" "github.com/docker/docker/pkg/stdcopy"
"github.com/docker/docker/utils"
"golang.org/x/net/context" "golang.org/x/net/context"
) )
@ -45,7 +46,7 @@ func (s *containerRouter) postContainerExecCreate(ctx context.Context, w http.Re
// Register an instance of Exec in container. // Register an instance of Exec in container.
id, err := s.backend.ContainerExecCreate(execConfig) id, err := s.backend.ContainerExecCreate(execConfig)
if err != nil { if err != nil {
logrus.Errorf("Error setting up exec command in container %s: %s", name, err) logrus.Errorf("Error setting up exec command in container %s: %s", name, utils.GetErrorMessage(err))
return err return err
} }
@ -112,7 +113,7 @@ func (s *containerRouter) postContainerExecStart(ctx context.Context, w http.Res
if execStartCheck.Detach { if execStartCheck.Detach {
return err return err
} }
logrus.Errorf("Error running exec in container: %v\n", err) logrus.Errorf("Error running exec in container: %v\n", utils.GetErrorMessage(err))
} }
return nil return nil
} }