Improve error messages for type mismatch on BoundStatement parameters

Description

When trying to bind an incorrect parameter, the error message thrown by the driver is something like "Not enough bytes... " or "Too many bytes...", that is the actual error message from Cassandra.

For SimpleStatements, the driver cannot do much about it as it serializes the parameters "blindly". But for BoundStatements, we CAN as we have the prepared statement metadata (parameters information) and we can determine if the source and target type matches.

Environment

None

Activity

Show:
Jorge Bay Gondra
October 23, 2014, 2:09 PM

I've added a validation for the PreparedStatement.Bind method.
It is a lightweight validation (source types that for sure don't fit as target types) in order to avoid introducing breaking changes.
For example: If a user is sending byte[] through the driver with the correct serialization format, we should still do that.

I've also added a validation for amount of parameters validation because I the error message by Cassandra could be confusing for the user.

Fixed

Assignee

Jorge Bay Gondra

Reporter

Jorge Bay Gondra

Labels

None

PM Priority

None

Fix versions

External issue ID

None

Doc Impact

None

Reviewer

None

Pull Request

None

Epic Link

None

Sprint

None

Pull Requests

None

Size

S

Components

Affects versions

Priority

Minor
Configure