Skip to content

Commit

Permalink
Return errors from client.ConnectAndRead read loop
Browse files Browse the repository at this point in the history
  • Loading branch information
rolandcrosby committed Oct 21, 2024
1 parent 39f24fb commit 22311f5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,11 @@ func (c *Client) ConnectAndRead(ctx context.Context, cursor *int64) error {
c.con = con

if err := c.readLoop(ctx); err != nil {
c.logger.Error("read loop failed", "error", err)
} else {
c.con.Close()
return fmt.Errorf("read loop failed: %w", err)
}

if err := c.con.Close(); err != nil {
return fmt.Errorf("failed to close connection: %w", err)
}

return nil
Expand Down

0 comments on commit 22311f5

Please sign in to comment.