etcdctl/ctlv2: error handling with JSON
This commit is contained in:
@ -41,7 +41,7 @@ func NewMakeDirCommand() cli.Command {
|
||||
// mkdirCommandFunc executes the "mkdir" command.
|
||||
func mkdirCommandFunc(c *cli.Context, ki client.KeysAPI, prevExist client.PrevExistType) {
|
||||
if len(c.Args()) == 0 {
|
||||
handleError(ExitBadArgs, errors.New("key required"))
|
||||
handleError(c, ExitBadArgs, errors.New("key required"))
|
||||
}
|
||||
|
||||
key := c.Args()[0]
|
||||
@ -51,7 +51,7 @@ func mkdirCommandFunc(c *cli.Context, ki client.KeysAPI, prevExist client.PrevEx
|
||||
resp, err := ki.Set(ctx, key, "", &client.SetOptions{TTL: time.Duration(ttl) * time.Second, Dir: true, PrevExist: prevExist})
|
||||
cancel()
|
||||
if err != nil {
|
||||
handleError(ExitServerError, err)
|
||||
handleError(c, ExitServerError, err)
|
||||
}
|
||||
if c.GlobalString("output") != "simple" {
|
||||
printResponseKey(resp, c.GlobalString("output"))
|
||||
|
Reference in New Issue
Block a user