Skip to content

Commit 5899fdf

Browse files
authored
Merge pull request #686 from rukai/handle_handshake_errors
Handle errors that occur during handshake
2 parents 758ec3e + 27c0d25 commit 5899fdf

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

scylla/src/transport/connection.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use bytes::Bytes;
22
use futures::{future::RemoteHandle, FutureExt};
33
use scylla_cql::errors::TranslationError;
4+
use scylla_cql::frame::response::Error;
45
use scylla_cql::frame::types::SerialConsistency;
56
use tokio::io::{split, AsyncRead, AsyncWrite, AsyncWriteExt, BufReader, BufWriter};
67
use tokio::net::{TcpSocket, TcpStream};
@@ -1216,6 +1217,7 @@ pub async fn open_named_connection(
12161217

12171218
let mut supported = match options_result {
12181219
Response::Supported(supported) => supported,
1220+
Response::Error(Error { error, reason }) => return Err(QueryError::DbError(error, reason)),
12191221
_ => {
12201222
return Err(QueryError::ProtocolError(
12211223
"Wrong response to OPTIONS message was received",
@@ -1269,6 +1271,7 @@ pub async fn open_named_connection(
12691271
Response::Authenticate(authenticate) => {
12701272
perform_authenticate(&mut connection, &authenticate).await?;
12711273
}
1274+
Response::Error(Error { error, reason }) => return Err(QueryError::DbError(error, reason)),
12721275
_ => {
12731276
return Err(QueryError::ProtocolError(
12741277
"Unexpected response to STARTUP message",

0 commit comments

Comments
 (0)