Skip to content

Commit 9140385

Browse files
committed
cass_error: stop abusing server protocol error
`CassError` is split into categories, by the issuer of the error: - `CASS_ERROR_LIB_*` for errors from the driver, - `CASS_ERROR_SERVER_*` for errors from the server, - `CASS_ERROR_SSL_*` for errors from the SSL library. The `CASS_ERROR_SERVER_PROTOCOL_ERROR` was used for errors that are not from the server, but from the driver, which is not correct. Among other things, it confuses users of the library, who expect SERVER errors to have come from the server, but they are actually from the driver. To fix this, such usages of the error were replaced with `CASS_ERROR_LIB_INVALID_STATE`.
1 parent 7080901 commit 9140385

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

scylla-rust-wrapper/src/cass_error.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,12 @@ impl ToCassError for RequestAttemptError {
9999
CassError::CASS_ERROR_LIB_UNEXPECTED_RESPONSE
100100
}
101101
RequestAttemptError::RepreparedIdChanged { .. } => {
102-
CassError::CASS_ERROR_SERVER_PROTOCOL_ERROR
102+
CassError::CASS_ERROR_LIB_INVALID_STATE
103103
}
104104
RequestAttemptError::RepreparedIdMissingInBatch => {
105-
CassError::CASS_ERROR_SERVER_PROTOCOL_ERROR
106-
}
107-
RequestAttemptError::NonfinishedPagingState => {
108-
CassError::CASS_ERROR_SERVER_PROTOCOL_ERROR
105+
CassError::CASS_ERROR_LIB_INVALID_STATE
109106
}
107+
RequestAttemptError::NonfinishedPagingState => CassError::CASS_ERROR_LIB_INVALID_STATE,
110108

111109
// RequestAttemptError is non_exhaustive.
112110
_ => CassError::CASS_ERROR_LAST_ENTRY,

0 commit comments

Comments
 (0)