etcdctl/ctlv2: error handling with JSON

This commit is contained in:
Gyu-Ho Lee
2016-11-01 19:52:42 -07:00
parent 71bad561e8
commit 9b470ef4c0
14 changed files with 42 additions and 29 deletions

View File

@ -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"))