Просмотр исходного кода

etcdctl/command: print more details about ErrNoEndpoint

This commit prints more details if getting ErrNoEndpoint when sync with
cluster. This helps users to know what happens.
Yicheng Qin 10 лет назад
Родитель
Сommit
c2caa4ae3b
1 измененных файлов с 4 добавлено и 0 удалено
  1. 4 0
      etcdctl/command/util.go

+ 4 - 0
etcdctl/command/util.go

@@ -221,6 +221,10 @@ func mustNewClient(c *cli.Context) client.Client {
 		err := hc.Sync(ctx)
 		cancel()
 		if err != nil {
+			if err == client.ErrNoEndpoints {
+				fmt.Fprintf(os.Stderr, "etcd cluster has no published client endpoints.\n")
+				fmt.Fprintf(os.Stderr, "Try '--no-sync' if you want to access non-published client endpoints(%s).\n", strings.Join(eps, ","))
+			}
 			handleError(ExitServerError, err)
 			os.Exit(1)
 		}