瀏覽代碼

etcdctlv3: put should check error

Xiang Li 10 年之前
父節點
當前提交
b5d5bf625d
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      etcdctlv3/command/put_command.go

+ 4 - 1
etcdctlv3/command/put_command.go

@@ -71,6 +71,9 @@ func putCommandFunc(cmd *cobra.Command, args []string) {
 	}
 
 	req := &pb.PutRequest{Key: key, Value: value, Lease: id}
-	mustClient(cmd).KV.Put(context.Background(), req)
+	_, err = mustClient(cmd).KV.Put(context.Background(), req)
+	if err != nil {
+		ExitWithError(ExitError, err)
+	}
 	fmt.Printf("%s %s\n", key, value)
 }