Skip to content

Commit

Permalink
client: improve error message for ClusterError
Browse files Browse the repository at this point in the history
  • Loading branch information
vikstrous committed Jun 22, 2016
1 parent cc837df commit da85108
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ func TestHTTPClusterClientAutoSyncFail(t *testing.T) {
}

err = hc.AutoSync(context.Background(), time.Hour)
if err.Error() != ErrClusterUnavailable.Error() {
if !strings.HasPrefix(err.Error(), ErrClusterUnavailable.Error()) {
t.Fatalf("incorrect error value: want=%v got=%v", ErrClusterUnavailable, err)
}
}
Expand Down
6 changes: 5 additions & 1 deletion client/cluster_error.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ type ClusterError struct {
}

func (ce *ClusterError) Error() string {
return ErrClusterUnavailable.Error()
s := ErrClusterUnavailable.Error()
for i, e := range ce.Errors {
s += fmt.Sprintf("; error #%d: %s\n", i, e)
}
return s
}

func (ce *ClusterError) Detail() string {
Expand Down

0 comments on commit da85108

Please sign in to comment.