@@ -533,25 +533,37 @@ Hi, I'm <g>Amazon Q</g>. I can answer questions about your workspace and tooling
533533 match tool. 1 . invoke ( & self . ctx , self . output ) . await {
534534 Ok ( result) => {
535535 debug ! ( "tool result output: {:#?}" , result) ;
536+ if let Some ( builder) = corresponding_builder {
537+ builder. is_success = Some ( true ) ;
538+ }
539+
536540 tool_results. push ( ToolResult {
537541 tool_use_id : tool. 0 ,
538542 content : vec ! [ result. into( ) ] ,
539543 status : ToolResultStatus :: Success ,
540544 } ) ;
541- if let Some ( builder) = corresponding_builder {
542- builder. is_success = Some ( true ) ;
543- }
544545 } ,
545546 Err ( err) => {
546547 error ! ( ?err, "An error occurred processing the tool" ) ;
547548 tool_results. push ( ToolResult {
548549 tool_use_id : tool. 0 ,
549550 content : vec ! [ ToolResultContentBlock :: Text ( format!(
550- "An error occurred processing the tool: {}" ,
551+ "An error occurred processing the tool: \n {}" ,
551552 err
552553 ) ) ] ,
553554 status : ToolResultStatus :: Error ,
554555 } ) ;
556+
557+ execute ! (
558+ self . output,
559+ style:: SetAttribute ( Attribute :: Bold ) ,
560+ style:: Print ( "Tool execution failed: " ) ,
561+ style:: SetAttribute ( Attribute :: Reset ) ,
562+ style:: SetForegroundColor ( Color :: Red ) ,
563+ style:: Print ( err) ,
564+ style:: SetForegroundColor ( Color :: Reset )
565+ ) ?;
566+
555567 if let Some ( builder) = corresponding_builder {
556568 builder. is_success = Some ( false ) ;
557569 }
0 commit comments