mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdctl: print out better error information
This commit is contained in:
parent
5d06d4ec44
commit
7e04a79fb4
@ -17,6 +17,8 @@ package command
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/coreos/etcd/client"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -29,5 +31,8 @@ const (
|
|||||||
|
|
||||||
func handleError(code int, err error) {
|
func handleError(code int, err error) {
|
||||||
fmt.Fprintln(os.Stderr, "Error: ", err)
|
fmt.Fprintln(os.Stderr, "Error: ", err)
|
||||||
|
if cerr, ok := err.(*client.ClusterError); ok {
|
||||||
|
fmt.Fprintln(os.Stderr, cerr.Detail())
|
||||||
|
}
|
||||||
os.Exit(code)
|
os.Exit(code)
|
||||||
}
|
}
|
||||||
|
@ -215,7 +215,7 @@ func mustNewClient(c *cli.Context) client.Client {
|
|||||||
err := hc.Sync(ctx)
|
err := hc.Sync(ctx)
|
||||||
cancel()
|
cancel()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintln(os.Stderr, err.Error())
|
handleError(ExitServerError, err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user