@@ -284,10 +284,18 @@ impl HttpServer {
284284 command,
285285 } ,
286286 Err ( e) => {
287+ let command_text = match & command {
288+ HttpCommand :: Query { query, .. } => format ! ( "HttpCommand::Query {{ query: {:?} }}" , query) ,
289+ HttpCommand :: Error { error } => format ! ( "HttpCommand::Error {{ error: {:?} }}" , error) ,
290+ HttpCommand :: CloseConnection { error } => format ! ( "HttpCommand::CloseConnection {{ error: {:?} }}" , error) ,
291+ HttpCommand :: ResultSet { .. } => format ! ( "HttpCommand::ResultSet {{}}" ) ,
292+ } ;
287293 log:: error!(
288- "Error processing HTTP command: {}\n " ,
289- e. display_with_backtrace( )
290- ) ;
294+ "Error processing HTTP command (connection_id={}): {}\n The command: {}" ,
295+ if let Some ( c) = connection_id. as_ref( ) { c. as_str( ) } else { "(None)" } ,
296+ e. display_with_backtrace( ) ,
297+ command_text,
298+ ) ;
291299 let command = if e. is_wrong_connection ( ) {
292300 HttpCommand :: CloseConnection {
293301 error : e. to_string ( ) ,
@@ -356,9 +364,11 @@ impl HttpServer {
356364 } ) ;
357365 } else {
358366 cube_ext:: spawn ( async move {
359- let command_query = match & command {
360- HttpCommand :: Query { query, .. } => Some ( query. clone ( ) ) ,
361- _ => None ,
367+ let command_text = match & command {
368+ HttpCommand :: Query { query, .. } => format ! ( "HttpCommand::Query {{ query: {:?} }}" , query) ,
369+ HttpCommand :: Error { error } => format ! ( "HttpCommand::Error {{ error: {:?} }}" , error) ,
370+ HttpCommand :: CloseConnection { error } => format ! ( "HttpCommand::CloseConnection {{ error: {:?} }}" , error) ,
371+ HttpCommand :: ResultSet { .. } => format ! ( "HttpCommand::ResultSet {{}}" ) ,
362372 } ;
363373 let res = HttpServer :: process_command (
364374 sql_service. clone ( ) ,
@@ -374,12 +384,9 @@ impl HttpServer {
374384 } ,
375385 Err ( e) => {
376386 log:: error!(
377- "Error processing HTTP command: {}{}" ,
387+ "Error processing HTTP command: {}\n The command: {}" ,
378388 e. display_with_backtrace( ) ,
379- match command_query {
380- Some ( query) => format!( "\n With query: '''\n {}\n '''" , query) ,
381- None => String :: new( ) ,
382- } ,
389+ command_text,
383390 ) ;
384391 HttpMessage {
385392 message_id,
0 commit comments