@@ -30,7 +30,6 @@ import (
3030 "github.com/containerd/containerd/containers"
3131 "github.com/containerd/containerd/log"
3232 "github.com/containerd/typeurl"
33- "github.com/pkg/errors"
3433 "github.com/urfave/cli"
3534)
3635
@@ -65,17 +64,17 @@ var createCommand = cli.Command{
6564 if config {
6665 id = context .Args ().First ()
6766 if context .NArg () > 1 {
68- return errors . New ( "with spec config file, only container id should be provided" )
67+ return commands . ErrArgConfigFile
6968 }
7069 } else {
7170 id = context .Args ().Get (1 )
7271 ref = context .Args ().First ()
7372 if ref == "" {
74- return errors . New ( "image ref must be provided" )
73+ return commands . ErrUnprovidedImageRef
7574 }
7675 }
7776 if id == "" {
78- return errors . New ( "container id must be provided" )
77+ return commands . ErrEmptyContainerID
7978 }
8079 client , ctx , cancel , err := commands .NewClient (context )
8180 if err != nil {
@@ -168,7 +167,7 @@ var deleteCommand = cli.Command{
168167 }
169168
170169 if context .NArg () == 0 {
171- return errors . New ( "must specify at least one container to delete" )
170+ return commands . ErrDeleteNoneContainer
172171 }
173172 for _ , arg := range context .Args () {
174173 if err := deleteContainer (ctx , client , arg , deleteOpts ... ); err != nil {
@@ -214,7 +213,7 @@ var setLabelsCommand = cli.Command{
214213 Action : func (context * cli.Context ) error {
215214 containerID , labels := commands .ObjectWithLabelArgs (context )
216215 if containerID == "" {
217- return errors . New ( "container id must be provided" )
216+ return commands . ErrEmptyContainerID
218217 }
219218 client , ctx , cancel , err := commands .NewClient (context )
220219 if err != nil {
@@ -250,7 +249,7 @@ var infoCommand = cli.Command{
250249 Action : func (context * cli.Context ) error {
251250 id := context .Args ().First ()
252251 if id == "" {
253- return errors . New ( "container id must be provided" )
252+ return commands . ErrEmptyContainerID
254253 }
255254 client , ctx , cancel , err := commands .NewClient (context )
256255 if err != nil {
0 commit comments