From 5cb42fac07da174648da8e4e68fda8e83640ab37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojciech=20Przytu=C5=82a?= Date: Thu, 26 Sep 2024 15:09:21 +0200 Subject: [PATCH] errors: impl From for QueryError 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. --- scylla/src/transport/errors.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/scylla/src/transport/errors.rs b/scylla/src/transport/errors.rs index f6b31b6c9..8ef4a9943 100644 --- a/scylla/src/transport/errors.rs +++ b/scylla/src/transport/errors.rs @@ -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, @@ -178,6 +178,18 @@ impl From for QueryError { } } +impl From 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]