Skip to content

Commit 7080901

Browse files
committed
cass_error: return INVALID_DATA where appropriate
`CASS_ERROR_LIB_INVALID_DATA` is returned in CPP Driver in cases where the CQL values to be serialized/deserialized are not valid. OTOH, `CASS_ERROR_LIB_UNEXPECTED_RESPONSE` is used when the message is valid in terms of binary protocol, but the driver does not expect it as a response in the current context. I decided that errors in frame deserialization warrant `INVALID_DATA` more then `UNEXPECTED_RESPONSE`.
1 parent 17f662f commit 7080901

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

scylla-rust-wrapper/src/cass_error.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,10 @@ impl ToCassError for RequestAttemptError {
9090
CassError::CASS_ERROR_LIB_NO_HOSTS_AVAILABLE
9191
}
9292
RequestAttemptError::BodyExtensionsParseError(_) => {
93-
CassError::CASS_ERROR_LIB_MESSAGE_ENCODE
94-
}
95-
RequestAttemptError::CqlResultParseError(_) => {
96-
CassError::CASS_ERROR_LIB_UNEXPECTED_RESPONSE
97-
}
98-
RequestAttemptError::CqlErrorParseError(_) => {
99-
CassError::CASS_ERROR_LIB_UNEXPECTED_RESPONSE
93+
CassError::CASS_ERROR_LIB_INVALID_DATA
10094
}
95+
RequestAttemptError::CqlResultParseError(_) => CassError::CASS_ERROR_LIB_INVALID_DATA,
96+
RequestAttemptError::CqlErrorParseError(_) => CassError::CASS_ERROR_LIB_INVALID_DATA,
10197
RequestAttemptError::DbError(db_error, _) => db_error.to_cass_error(),
10298
RequestAttemptError::UnexpectedResponse(_) => {
10399
CassError::CASS_ERROR_LIB_UNEXPECTED_RESPONSE

0 commit comments

Comments
 (0)