diff --git a/etcdctl/command/error.go b/etcdctl/command/error.go index a43ff9b91..a521da739 100644 --- a/etcdctl/command/error.go +++ b/etcdctl/command/error.go @@ -17,6 +17,8 @@ package command import ( "fmt" "os" + + "github.com/coreos/etcd/client" ) const ( @@ -29,5 +31,8 @@ const ( func handleError(code int, err error) { fmt.Fprintln(os.Stderr, "Error: ", err) + if cerr, ok := err.(*client.ClusterError); ok { + fmt.Fprintln(os.Stderr, cerr.Detail()) + } os.Exit(code) } diff --git a/etcdctl/command/util.go b/etcdctl/command/util.go index e213bea90..a3f70d065 100644 --- a/etcdctl/command/util.go +++ b/etcdctl/command/util.go @@ -215,7 +215,7 @@ func mustNewClient(c *cli.Context) client.Client { err := hc.Sync(ctx) cancel() if err != nil { - fmt.Fprintln(os.Stderr, err.Error()) + handleError(ExitServerError, err) os.Exit(1) } }