Skip to content

Commit 9e77cfd

Browse files
committed
errors: move PartitionKeyExtraction variant from ProtError to BadQuery
I believe that this is currently the best fitting place for this variant.
1 parent 6f5a603 commit 9e77cfd

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

scylla/src/errors.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,7 @@ pub enum NewSessionError {
161161
/// of internal driver API - a driver bug.
162162
#[derive(Error, Debug, Clone)]
163163
#[non_exhaustive]
164-
pub enum ProtocolError {
165-
/// Unable extract a partition key based on prepared statement's metadata.
166-
#[error("Unable extract a partition key based on prepared statement's metadata")]
167-
PartitionKeyExtraction,
168-
}
164+
pub enum ProtocolError {}
169165

170166
/// An error that occurred during `USE KEYSPACE <>` request.
171167
#[derive(Error, Debug, Clone)]
@@ -437,6 +433,10 @@ pub enum TablesMetadataError {
437433
#[error("Invalid query passed to Session")]
438434
#[non_exhaustive]
439435
pub enum BadQuery {
436+
/// Unable extract a partition key based on prepared statement's metadata.
437+
#[error("Unable extract a partition key based on prepared statement's metadata")]
438+
PartitionKeyExtraction,
439+
440440
#[error("Serializing values failed: {0} ")]
441441
SerializationError(#[from] SerializationError),
442442

scylla/src/statement/prepared_statement.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use uuid::Uuid;
1414

1515
use super::{PageSize, StatementConfig};
1616
use crate::client::execution_profile::ExecutionProfileHandle;
17-
use crate::errors::{BadQuery, ExecutionError, ProtocolError};
17+
use crate::errors::{BadQuery, ExecutionError};
1818
use crate::frame::response::result::PreparedMetadata;
1919
use crate::frame::types::{Consistency, SerialConsistency};
2020
use crate::observability::history::HistoryListener;
@@ -498,7 +498,7 @@ impl PartitionKeyError {
498498
pub fn into_execution_error(self) -> ExecutionError {
499499
match self {
500500
PartitionKeyError::PartitionKeyExtraction(_) => {
501-
ExecutionError::ProtocolError(ProtocolError::PartitionKeyExtraction)
501+
ExecutionError::BadQuery(BadQuery::PartitionKeyExtraction)
502502
}
503503
PartitionKeyError::TokenCalculation(TokenCalculationError::ValueTooLong(
504504
values_len,

0 commit comments

Comments
 (0)