Skip to content

Commit

Permalink
errors: impl From<RowsParseError> for QueryError
Browse files Browse the repository at this point in the history
RowsParseError is going to be a user-facing error type, because it is
going to be returned from new QueryResult API. For convenient conversion
into QueryError, a shortcut From impl is added.
  • Loading branch information
wprzytula committed Oct 11, 2024
1 parent 413573c commit 5cb42fa
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion scylla/src/transport/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use scylla_cql::{
CqlAuthChallengeParseError, CqlAuthSuccessParseError, CqlAuthenticateParseError,
CqlErrorParseError, CqlEventParseError, CqlRequestSerializationError,
CqlResponseParseError, CqlResultParseError, CqlSupportedParseError,
FrameBodyExtensionsParseError, FrameHeaderParseError,
FrameBodyExtensionsParseError, FrameHeaderParseError, RowsParseError,
},
request::CqlRequestKind,
response::CqlResponseKind,
Expand Down Expand Up @@ -178,6 +178,18 @@ impl From<response::Error> for QueryError {
}
}

impl From<RowsParseError> for QueryError {
fn from(err: RowsParseError) -> Self {
let err: CqlResultParseError = err.into();
let err: CqlResponseParseError = err.into();
let err: RequestError = err.into();
let err: UserRequestError = err.into();
let err: QueryError = err.into();

err
}
}

/// Error that occurred during session creation
#[derive(Error, Debug, Clone)]
#[non_exhaustive]
Expand Down

0 comments on commit 5cb42fa

Please sign in to comment.