Skip to content

Commit

Permalink
errors: impl deser errors conversions to QueryError
Browse files Browse the repository at this point in the history
This is a temporary measure, until error refactor gets rid of the awful
QueryError::InvalidMessage(String) variant and replaces it with a decent
matchable error.
  • Loading branch information
wprzytula committed Aug 22, 2024
1 parent 7eb4e86 commit 925ddb9
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions scylla-cql/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use crate::frame::frame_errors::{CqlResponseParseError, FrameError, ParseError};
use crate::frame::protocol_features::ProtocolFeatures;
use crate::frame::value::SerializeValuesError;
use crate::types::deserialize::{DeserializationError, TypeCheckError};
use crate::types::serialize::SerializationError;
use crate::Consistency;
use bytes::Bytes;
Expand Down Expand Up @@ -461,6 +462,18 @@ impl From<SerializationError> for QueryError {
}
}

impl From<DeserializationError> for QueryError {
fn from(value: DeserializationError) -> Self {
Self::InvalidMessage(value.to_string())
}
}

impl From<TypeCheckError> for QueryError {
fn from(value: TypeCheckError) -> Self {
Self::InvalidMessage(value.to_string())
}
}

impl From<ParseError> for QueryError {
fn from(parse_error: ParseError) -> QueryError {
QueryError::InvalidMessage(format!("Error parsing message: {}", parse_error))
Expand Down

0 comments on commit 925ddb9

Please sign in to comment.