@@ -28,8 +28,10 @@ import (
2828 "github.com/containerd/containerd/cmd/ctr/commands"
2929 "github.com/containerd/containerd/cmd/ctr/commands/run"
3030 "github.com/containerd/containerd/containers"
31+ "github.com/containerd/containerd/errdefs"
3132 "github.com/containerd/containerd/log"
3233 "github.com/containerd/typeurl"
34+ "github.com/pkg/errors"
3335 "github.com/urfave/cli"
3436)
3537
@@ -64,17 +66,17 @@ var createCommand = cli.Command{
6466 if config {
6567 id = context .Args ().First ()
6668 if context .NArg () > 1 {
67- return commands . ErrArgConfigFile
69+ return errors . Wrap ( errdefs . ErrInvalidArgument , "with spec config file, only container id should be provided" )
6870 }
6971 } else {
7072 id = context .Args ().Get (1 )
7173 ref = context .Args ().First ()
7274 if ref == "" {
73- return commands . ErrUnprovidedImageRef
75+ return errors . Wrap ( errdefs . ErrInvalidArgument , "image ref must be provided" )
7476 }
7577 }
7678 if id == "" {
77- return commands . ErrEmptyContainerID
79+ return errors . Wrap ( errdefs . ErrInvalidArgument , "container id must be provided" )
7880 }
7981 client , ctx , cancel , err := commands .NewClient (context )
8082 if err != nil {
@@ -167,7 +169,7 @@ var deleteCommand = cli.Command{
167169 }
168170
169171 if context .NArg () == 0 {
170- return commands . ErrDeleteNoneContainer
172+ return errors . Wrap ( errdefs . ErrInvalidArgument , "must specify at least one container to delete" )
171173 }
172174 for _ , arg := range context .Args () {
173175 if err := deleteContainer (ctx , client , arg , deleteOpts ... ); err != nil {
@@ -213,7 +215,7 @@ var setLabelsCommand = cli.Command{
213215 Action : func (context * cli.Context ) error {
214216 containerID , labels := commands .ObjectWithLabelArgs (context )
215217 if containerID == "" {
216- return commands . ErrEmptyContainerID
218+ return errors . Wrap ( errdefs . ErrInvalidArgument , "container id must be provided" )
217219 }
218220 client , ctx , cancel , err := commands .NewClient (context )
219221 if err != nil {
@@ -249,7 +251,7 @@ var infoCommand = cli.Command{
249251 Action : func (context * cli.Context ) error {
250252 id := context .Args ().First ()
251253 if id == "" {
252- return commands . ErrEmptyContainerID
254+ return errors . Wrap ( errdefs . ErrInvalidArgument , "container id must be provided" )
253255 }
254256 client , ctx , cancel , err := commands .NewClient (context )
255257 if err != nil {
0 commit comments