@@ -103,9 +103,16 @@ pub enum QueryError {
103103 #[ error( "Unable to allocate stream id" ) ]
104104 UnableToAllocStreamId ,
105105
106- /// Client timeout occurred before any response arrived
107- #[ error( "Request timeout: {0}" ) ]
108- RequestTimeout ( String ) ,
106+ /// Failed to run a request within a provided client timeout.
107+ #[ error(
108+ "Request execution exceeded a client timeout of {}ms" ,
109+ std:: time:: Duration :: as_millis( . 0 )
110+ ) ]
111+ RequestTimeout ( std:: time:: Duration ) ,
112+
113+ /// Schema agreement timed out.
114+ #[ error( "Schema agreement exceeded {}ms" , std:: time:: Duration :: as_millis( . 0 ) ) ]
115+ SchemaAgreementTimeout ( std:: time:: Duration ) ,
109116
110117 // TODO: This should not belong here, but it requires changes to error types
111118 // returned in async iterator API. This should be handled in separate PR.
@@ -139,12 +146,6 @@ impl From<SerializationError> for QueryError {
139146 }
140147}
141148
142- impl From < tokio:: time:: error:: Elapsed > for QueryError {
143- fn from ( timer_error : tokio:: time:: error:: Elapsed ) -> QueryError {
144- QueryError :: RequestTimeout ( format ! ( "{}" , timer_error) )
145- }
146- }
147-
148149impl From < QueryError > for NewSessionError {
149150 fn from ( query_error : QueryError ) -> NewSessionError {
150151 match query_error {
@@ -161,7 +162,8 @@ impl From<QueryError> for NewSessionError {
161162 QueryError :: TimeoutError => NewSessionError :: TimeoutError ,
162163 QueryError :: BrokenConnection ( e) => NewSessionError :: BrokenConnection ( e) ,
163164 QueryError :: UnableToAllocStreamId => NewSessionError :: UnableToAllocStreamId ,
164- QueryError :: RequestTimeout ( msg) => NewSessionError :: RequestTimeout ( msg) ,
165+ QueryError :: RequestTimeout ( dur) => NewSessionError :: RequestTimeout ( dur) ,
166+ QueryError :: SchemaAgreementTimeout ( dur) => NewSessionError :: SchemaAgreementTimeout ( dur) ,
165167 #[ allow( deprecated) ]
166168 QueryError :: IntoLegacyQueryResultError ( e) => {
167169 NewSessionError :: IntoLegacyQueryResultError ( e)
@@ -254,10 +256,16 @@ pub enum NewSessionError {
254256 #[ error( "Unable to allocate stream id" ) ]
255257 UnableToAllocStreamId ,
256258
257- /// Client timeout occurred before a response arrived for some query
258- /// during `Session` creation.
259- #[ error( "Client timeout: {0}" ) ]
260- RequestTimeout ( String ) ,
259+ /// Failed to run a request within a provided client timeout.
260+ #[ error(
261+ "Request execution exceeded a client timeout of {}ms" ,
262+ std:: time:: Duration :: as_millis( . 0 )
263+ ) ]
264+ RequestTimeout ( std:: time:: Duration ) ,
265+
266+ /// Schema agreement timed out.
267+ #[ error( "Schema agreement exceeded {}ms" , std:: time:: Duration :: as_millis( . 0 ) ) ]
268+ SchemaAgreementTimeout ( std:: time:: Duration ) ,
261269
262270 // TODO: This should not belong here, but it requires changes to error types
263271 // returned in async iterator API. This should be handled in separate PR.
0 commit comments