Skip to content

Commit 549afc5

Browse files
committed
Merge branch 'feature/log_connection_errors' into develop
2 parents 6a5d05b + ad31c85 commit 549afc5

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

55
## Unreleased
6+
### Changed
7+
- Improved logging of connection errors
8+
69
### Fixed
710
- Fixed bug causing empty times to be inserted into the DB even when the omitempty tag was set.
811

cluster.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ func (c *Cluster) connectNodes(hosts []Host) {
191191
for _, host := range hosts {
192192
conn, err := NewConnection(host.String(), c.opts)
193193
if err != nil {
194+
log.Warnf("Error creating connection %s", err.Error())
194195
continue
195196
}
196197
defer conn.Close()
@@ -201,6 +202,7 @@ func (c *Cluster) connectNodes(hosts []Host) {
201202
c.opts,
202203
))
203204
if err != nil {
205+
log.Warnf("Error fetching cluster status %s", err)
204206
continue
205207
}
206208

connection_helper.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"encoding/binary"
66
"fmt"
77
"io"
8+
"strings"
89

910
p "github.com/dancannon/gorethink/ql2"
1011
)
@@ -60,6 +61,7 @@ func (c *Connection) readHandshakeSuccess() error {
6061
// convert to string and remove trailing NUL byte
6162
response := string(line[:len(line)-1])
6263
if response != "SUCCESS" {
64+
response = strings.TrimSpace(response)
6365
// we failed authorization or something else terrible happened
6466
return RqlDriverError{fmt.Sprintf("Server dropped connection with message: \"%s\"", response)}
6567
}

0 commit comments

Comments
 (0)