Skip to content

Commit a3c6827

Browse files
committed
cass_error: BadQuery -> MESSAGE_ENCODE conversion
I believe that the `BadQuery` enum variants that were previously returning `CASS_ERROR_LAST_ENTRY` (as an obvious placeholder) should instead return `CASS_ERROR_LIB_MESSAGE_ENCODE`. This change is made to ensure that the error handling is more specific and meaningful, particularly for cases where the query is malformed or exceeds certain limits. I understand `CASS_ERROR_LIB_MESSAGE_ENCODE` as a general error for issues around serialization.
1 parent 9140385 commit a3c6827

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

scylla-rust-wrapper/src/cass_error.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,13 @@ impl ToCassError for DbError {
147147
impl ToCassError for BadQuery {
148148
fn to_cass_error(&self) -> CassError {
149149
match self {
150-
BadQuery::ValuesTooLongForKey(_usize, _usize2) => CassError::CASS_ERROR_LAST_ENTRY,
151-
BadQuery::PartitionKeyExtraction => CassError::CASS_ERROR_LAST_ENTRY,
150+
BadQuery::ValuesTooLongForKey(_usize, _usize2) => {
151+
CassError::CASS_ERROR_LIB_MESSAGE_ENCODE
152+
}
153+
BadQuery::PartitionKeyExtraction => CassError::CASS_ERROR_LIB_MESSAGE_ENCODE,
152154
BadQuery::SerializationError(e) => e.to_cass_error(),
153-
BadQuery::TooManyQueriesInBatchStatement(_) => CassError::CASS_ERROR_LAST_ENTRY,
155+
BadQuery::TooManyQueriesInBatchStatement(_) => CassError::CASS_ERROR_LIB_MESSAGE_ENCODE,
154156
// BadQuery is non_exhaustive
155-
// For now, since all other variants return LAST_ENTRY,
156-
// let's do it here as well.
157157
_ => CassError::CASS_ERROR_LAST_ENTRY,
158158
}
159159
}

0 commit comments

Comments
 (0)