From c2caa4ae3b22596c5751937edf7ae1785f85e7f0 Mon Sep 17 00:00:00 2001 From: Yicheng Qin Date: Mon, 31 Aug 2015 15:57:12 -0700 Subject: [PATCH] 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. --- etcdctl/command/util.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/etcdctl/command/util.go b/etcdctl/command/util.go index 31b2f8b7d..ac6dbeda1 100644 --- a/etcdctl/command/util.go +++ b/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) }