Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ func (cfg *ClusterConfig) filterHost(host *HostInfo) bool {
}

var (
ErrNoHosts = errors.New("no hosts provided")
ErrNoConnectionsStarted = errors.New("no connections were made when creating the session")
ErrHostQueryFailed = errors.New("unable to populate Hosts")
ErrAuthenticatorAndAuthProvider = errors.New("gocql: Can't use both Authenticator and AuthProvider in cluster config.")
ErrNoHosts = errors.New("gocql: no hosts provided")
ErrNoConnectionsStarted = errors.New("gocql: no connections were made when creating the session")
)
14 changes: 7 additions & 7 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ type PasswordAuthenticator struct {

func (p PasswordAuthenticator) Challenge(req []byte) ([]byte, Authenticator, error) {
if !approve(string(req), p.AllowedAuthenticators) {
return nil, nil, fmt.Errorf("unexpected authenticator %q", req)
return nil, nil, fmt.Errorf("gocql: unexpected authenticator %q", req)
}
resp := make([]byte, 2+len(p.Username)+len(p.Password))
resp[0] = 0
Expand Down Expand Up @@ -459,7 +459,7 @@ func (s *startupCoordinator) startup(ctx context.Context, supported map[string][

func (s *startupCoordinator) authenticateHandshake(ctx context.Context, authFrame *authenticateFrame, startupCompleted *atomic.Bool) error {
if s.conn.auth == nil {
return fmt.Errorf("authentication required (using %q)", authFrame.class)
return fmt.Errorf("gocql: authentication required (using %q)", authFrame.class)
}

resp, challenger, err := s.conn.auth.Challenge([]byte(authFrame.class))
Expand Down Expand Up @@ -492,7 +492,7 @@ func (s *startupCoordinator) authenticateHandshake(ctx context.Context, authFram
data: resp,
}
default:
return fmt.Errorf("unknown frame response during authentication: %v", v)
return fmt.Errorf("gocql: unknown frame response during authentication: %v", v)
}
}
}
Expand Down Expand Up @@ -1166,7 +1166,7 @@ func (c *Conn) addCall(call *callReq) error {
}
existingCall := c.calls[call.streamID]
if existingCall != nil {
return fmt.Errorf("attempting to use stream already in use: %d -> %d", call.streamID,
return fmt.Errorf("gocql: attempting to use stream already in use: %d -> %d", call.streamID,
existingCall.streamID)
}
c.calls[call.streamID] = call
Expand Down Expand Up @@ -1451,7 +1451,7 @@ func (c *Conn) prepareStatement(ctx context.Context, stmt string, tracer Tracer,
response: x.respMeta,
}
case error:
flight.err = x
flight.err = fmt.Errorf("cassandra: %w", x)
default:
flight.err = NewErrProtocol("Unknown type in response to prepare frame: %s", x)
}
Expand Down Expand Up @@ -1727,7 +1727,7 @@ func (c *Conn) UseKeyspace(keyspace string) error {
switch x := resp.(type) {
case *resultKeyspaceFrame:
case error:
return x
return fmt.Errorf("cassandra: %w", x)
default:
return NewErrProtocol("unknown frame in response to USE: %v", x)
}
Expand Down Expand Up @@ -1845,7 +1845,7 @@ func (c *Conn) executeBatch(ctx context.Context, batch *Batch) *Iter {

return iter
case error:
return &Iter{err: x, framer: framer}
return &Iter{err: fmt.Errorf("cassandra: %w", x), framer: framer}
default:
return &Iter{err: NewErrProtocol("Unknown type in response to batch statement: %s", x), framer: framer}
}
Expand Down
12 changes: 6 additions & 6 deletions control.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func hostInfo(addr string, defaultPort int) ([]*HostInfo, error) {
if err != nil {
return nil, err
} else if len(ips) == 0 {
return nil, fmt.Errorf("no IP's returned from DNS lookup for %q", addr)
return nil, fmt.Errorf("gocql: no IP's returned from DNS lookup for %q", addr)
}

// Filter to v4 addresses if any present
Expand Down Expand Up @@ -284,7 +284,7 @@ func (c *controlConn) connect(hosts []*HostInfo) error {
conn = nil
}
if conn == nil {
return fmt.Errorf("unable to connect to initial hosts: %v", err)
return fmt.Errorf("gocql: unable to connect to initial hosts: %w", err)
}

// we could fetch the initial ring here and update initial host data. So that
Expand All @@ -311,11 +311,11 @@ func (c *controlConn) setupConn(conn *Conn) error {
host = c.session.ring.addOrUpdate(host)

if c.session.cfg.filterHost(host) {
return fmt.Errorf("host was filtered: %v", host.ConnectAddress())
return fmt.Errorf("gocql: host was filtered: %v", host.ConnectAddress())
}

if err := c.registerEvents(conn); err != nil {
return fmt.Errorf("register events: %v", err)
return fmt.Errorf("gocql: register events: %w", err)
}

ch := &connHost{
Expand Down Expand Up @@ -365,7 +365,7 @@ func (c *controlConn) registerEvents(conn *Conn) error {
if err != nil {
return err
} else if _, ok := frame.(*readyFrame); !ok {
return fmt.Errorf("unexpected frame in response to register: got %T: %v\n", frame, frame)
return fmt.Errorf("gocql: unexpected frame in response to register: got %T: %v\n", frame, frame)
}

return nil
Expand Down Expand Up @@ -422,7 +422,7 @@ func (c *controlConn) attemptReconnect() (*Conn, error) {
// changed their IPs while keeping the same hostname(s).
initialHosts, resolvErr := addrsToHosts(c.session.cfg.Hosts, c.session.cfg.Port, c.session.logger)
if resolvErr != nil {
return nil, fmt.Errorf("resolve contact points' hostnames: %v", resolvErr)
return nil, fmt.Errorf("gocql: resolve contact points' hostnames: %w", resolvErr)
}

return c.attemptReconnectToAnyOfHosts(initialHosts)
Expand Down
4 changes: 2 additions & 2 deletions dial.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ func (hd *defaultHostDialer) DialHost(ctx context.Context, host *HostInfo) (*Dia
port := host.Port()

if !validIpAddr(ip) {
return nil, fmt.Errorf("host missing connect ip address: %v", ip)
return nil, fmt.Errorf("gocql: host missing connect ip address: %v", ip)
} else if port == 0 {
return nil, fmt.Errorf("host missing port: %v", port)
return nil, fmt.Errorf("gocql: host missing port: %v", port)
}

connAddr := host.ConnectAddressAndPort()
Expand Down
2 changes: 1 addition & 1 deletion filters.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func WhiteListHostFilter(hosts ...string) HostFilter {
hostInfos, err := addrsToHosts(hosts, 9042, nopLogger{})
if err != nil {
// dont want to panic here, but rather not break the API
panic(fmt.Errorf("unable to lookup host info from address: %v", err))
panic(fmt.Errorf("gocql: unable to lookup host info from address: %w", err))
}

m := make(map[string]bool, len(hostInfos))
Expand Down
Loading