@@ -463,10 +463,9 @@ impl Connection {
463463 ) -> Result < QueryResult , QueryError > {
464464 if query. get_page_size ( ) . is_none ( ) {
465465 // Page size should be set when someone wants to use paging
466- // This is an internal function, we can use ProtocolError even if it's not technically desigen for this
467- return Err ( QueryError :: ProtocolError (
468- "Called Connection::query_all without page size set!" ,
469- ) ) ;
466+ return Err ( QueryError :: BadQuery ( BadQuery :: Other (
467+ "Called Connection::query_all without page size set!" . to_string ( ) ,
468+ ) ) ) ;
470469 }
471470
472471 let mut final_result = QueryResult :: default ( ) ;
@@ -582,10 +581,9 @@ impl Connection {
582581 values : impl ValueList ,
583582 ) -> Result < QueryResult , QueryError > {
584583 if prepared_statement. get_page_size ( ) . is_none ( ) {
585- // This is an internal function, we can use ProtocolError even if it's not technically desigen for this
586- return Err ( QueryError :: ProtocolError (
587- "Called Connection::execute_all without page size set!" ,
588- ) ) ;
584+ return Err ( QueryError :: BadQuery ( BadQuery :: Other (
585+ "Called Connection::execute_all without page size set!" . to_string ( ) ,
586+ ) ) ) ;
589587 }
590588
591589 let mut final_result = QueryResult :: default ( ) ;
@@ -1531,6 +1529,8 @@ impl VerifiedKeyspaceName {
15311529
15321530#[ cfg( test) ]
15331531mod tests {
1532+ use scylla_cql:: errors:: BadQuery ;
1533+
15341534 use super :: super :: errors:: QueryError ;
15351535 use super :: ConnectionConfig ;
15361536 use crate :: query:: Query ;
@@ -1643,15 +1643,18 @@ mod tests {
16431643 // 4. Calling query_all with a Query that doesn't have page_size set should result in an error.
16441644 let no_page_size_query = Query :: new ( "SELECT p FROM connection_query_all_tab" ) ;
16451645 let no_page_res = connection. query_all ( & no_page_size_query, & [ ] ) . await ;
1646- assert ! ( matches!( no_page_res, Err ( QueryError :: ProtocolError ( _) ) ) ) ;
1646+ assert ! ( matches!(
1647+ no_page_res,
1648+ Err ( QueryError :: BadQuery ( BadQuery :: Other ( _) ) )
1649+ ) ) ;
16471650
16481651 let prepared_no_page_size_query = connection. prepare ( & no_page_size_query) . await . unwrap ( ) ;
16491652 let prepared_no_page_res = connection
16501653 . execute_all ( & prepared_no_page_size_query, & [ ] )
16511654 . await ;
16521655 assert ! ( matches!(
16531656 prepared_no_page_res,
1654- Err ( QueryError :: ProtocolError ( _ ) )
1657+ Err ( QueryError :: BadQuery ( BadQuery :: Other ( _ ) ) )
16551658 ) ) ;
16561659 }
16571660}
0 commit comments