Skip to content

Commit

Permalink
Review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasz-antoniak committed Jul 30, 2024
1 parent cd418fe commit 68126a8
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -812,14 +812,13 @@ func (c *client) interceptSystemQuery(hdr *frame.Header, stmt interface{}) {
}
case *parser.UseStatement:
if _, err := c.proxy.maybeCreateSession(hdr.Version, s.Keyspace); err != nil {
errMsg := "Proxy unable to create new session for keyspace"
var cqlError *proxycore.CqlError
switch {
case errors.As(err, &cqlError):
errMsg := cqlError.Message
c.send(hdr, errMsg)
default:
c.send(hdr, &message.ServerError{ErrorMessage: "Proxy unable to create new session for keyspace"})
if errors.As(err, &cqlError) {
// copy detailed error reason from downstream message
errMsg = cqlError.Message.GetErrorMessage()
}
c.send(hdr, &message.ServerError{ErrorMessage: errMsg})
} else {
c.keyspace = s.Keyspace
// We might have received a quoted keyspace name in the UseStatement so remove any
Expand Down

0 comments on commit 68126a8

Please sign in to comment.