diff --git a/scylla-cql/src/errors.rs b/scylla-cql/src/errors.rs index e9499dfb7d..97822f6fb6 100644 --- a/scylla-cql/src/errors.rs +++ b/scylla-cql/src/errors.rs @@ -25,9 +25,13 @@ pub enum QueryError { #[error(transparent)] BadQuery(#[from] BadQuery), - /// Failed to deserialize a CQL response from the server. + /// Received a RESULT server response, but failed to deserialize it. #[error(transparent)] - CqlResponseParseError(#[from] CqlResponseParseError), + CqlResultParseError(#[from] CqlResultParseError), + + /// Received an ERROR server response, but failed to deserialize it. + #[error("Failed to deserialize ERROR response: {0}")] + CqlErrorParseError(#[from] CqlErrorParseError), /// Input/Output error has occurred, connection broken etc. #[error("IO Error: {0}")] @@ -415,9 +419,13 @@ pub enum NewSessionError { #[error(transparent)] BadQuery(#[from] BadQuery), - /// Failed to deserialize a CQL response from the server. + /// Received a RESULT server response, but failed to deserialize it. #[error(transparent)] - CqlResponseParseError(#[from] CqlResponseParseError), + CqlResultParseError(#[from] CqlResultParseError), + + /// Received an ERROR server response, but failed to deserialize it. + #[error("Failed to deserialize ERROR response: {0}")] + CqlErrorParseError(#[from] CqlErrorParseError), /// Input/Output error has occurred, connection broken etc. #[error("IO Error: {0}")] @@ -618,14 +626,8 @@ impl From for QueryError { fn from(value: UserRequestError) -> Self { match value { UserRequestError::DbError(err, msg) => QueryError::DbError(err, msg), - UserRequestError::CqlResultParseError(e) => { - // FIXME: change later - CqlResponseParseError::CqlResultParseError(e).into() - } - UserRequestError::CqlErrorParseError(e) => { - // FIXME: change later - CqlResponseParseError::CqlErrorParseError(e).into() - } + UserRequestError::CqlResultParseError(e) => e.into(), + UserRequestError::CqlErrorParseError(e) => e.into(), UserRequestError::BrokenConnectionError(e) => e.into(), UserRequestError::UnexpectedResponse => { // FIXME: make it typed. It needs to wait for ProtocolError refactor. @@ -651,7 +653,8 @@ impl From for NewSessionError { match query_error { QueryError::DbError(e, msg) => NewSessionError::DbError(e, msg), QueryError::BadQuery(e) => NewSessionError::BadQuery(e), - QueryError::CqlResponseParseError(e) => NewSessionError::CqlResponseParseError(e), + QueryError::CqlResultParseError(e) => NewSessionError::CqlResultParseError(e), + QueryError::CqlErrorParseError(e) => NewSessionError::CqlErrorParseError(e), QueryError::IoError(e) => NewSessionError::IoError(e), QueryError::ProtocolError(m) => NewSessionError::ProtocolError(m), QueryError::InvalidMessage(m) => NewSessionError::InvalidMessage(m), diff --git a/scylla/src/transport/load_balancing/default.rs b/scylla/src/transport/load_balancing/default.rs index 07e4b58033..38eb6915ec 100644 --- a/scylla/src/transport/load_balancing/default.rs +++ b/scylla/src/transport/load_balancing/default.rs @@ -2848,7 +2848,8 @@ mod latency_awareness { // "slow" errors, i.e. ones that are returned after considerable time of query being run QueryError::DbError(_, _) - | QueryError::CqlResponseParseError(_) + | QueryError::CqlResultParseError(_) + | QueryError::CqlErrorParseError(_) | QueryError::InvalidMessage(_) | QueryError::IoError(_) | QueryError::ProtocolError(_)