Skip to content

Commit 75fdbaa

Browse files
authored
Merge pull request #14 from rolandcrosby/return-client-errors
Return errors from client.ConnectAndRead read loop
2 parents 39f24fb + 22311f5 commit 75fdbaa

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pkg/client/client.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,11 @@ func (c *Client) ConnectAndRead(ctx context.Context, cursor *int64) error {
116116
c.con = con
117117

118118
if err := c.readLoop(ctx); err != nil {
119-
c.logger.Error("read loop failed", "error", err)
120-
} else {
121-
c.con.Close()
119+
return fmt.Errorf("read loop failed: %w", err)
120+
}
121+
122+
if err := c.con.Close(); err != nil {
123+
return fmt.Errorf("failed to close connection: %w", err)
122124
}
123125

124126
return nil

0 commit comments

Comments
 (0)