diff --git a/etcd.go b/etcd.go index 5bd110a77c1..9b4d23f3200 100644 --- a/etcd.go +++ b/etcd.go @@ -501,6 +501,9 @@ func joinCluster(s *raft.Server, serverName string) error { resp, err := t.Post(fmt.Sprintf("%s/join", serverName), &b) for { + if err != nil { + return fmt.Errorf("Unable to join: %v", err) + } if resp != nil { defer resp.Body.Close() if resp.StatusCode == http.StatusOK { diff --git a/transporter.go b/transporter.go index 8d71b585a83..0eb6c5599e0 100644 --- a/transporter.go +++ b/transporter.go @@ -26,7 +26,11 @@ func (t transporter) SendAppendEntriesRequest(server *raft.Server, peer *raft.Pe debug("Send LogEntries to %s ", peer.Name()) - resp, _ := t.Post(fmt.Sprintf("%s/log/append", peer.Name()), &b) + resp, err := t.Post(fmt.Sprintf("%s/log/append", peer.Name()), &b) + + if err != nil { + debug("Cannot send AppendEntriesRequest to %s : %s", peer.Name(), err) + } if resp != nil { defer resp.Body.Close() @@ -47,7 +51,11 @@ func (t transporter) SendVoteRequest(server *raft.Server, peer *raft.Peer, req * debug("Send Vote to %s", peer.Name()) - resp, _ := t.Post(fmt.Sprintf("%s/vote", peer.Name()), &b) + resp, err := t.Post(fmt.Sprintf("%s/vote", peer.Name()), &b) + + if err != nil { + debug("Cannot send VoteRequest to %s : %s", peer.Name(), err) + } if resp != nil { defer resp.Body.Close()