File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change 11using System . Reflection ;
2+ using System . Text ;
23using AIShell . Abstraction ;
34using AIShell . Kernel . Commands ;
45using AIShell . Kernel . Mcp ;
@@ -686,8 +687,24 @@ internal async Task RunREPLAsync()
686687 continue ;
687688 }
688689
690+ StringBuilder sb = null ;
691+ string message = ex . Message ;
692+ string stackTrace = ex . StackTrace ;
693+
694+ while ( ex . InnerException is { } )
695+ {
696+ sb ??= new ( message , capacity : message . Length * 3 ) ;
697+ sb . Append ( $ "\n Inner -> { ex . InnerException . Message } ") ;
698+ ex = ex . InnerException ;
699+ }
700+
701+ if ( sb is not null )
702+ {
703+ message = sb . ToString ( ) ;
704+ }
705+
689706 Host . WriteErrorLine ( )
690- . WriteErrorLine ( $ "Agent failed to generate a response: { ex . Message } \n { ex . StackTrace } ")
707+ . WriteErrorLine ( $ "Agent failed to generate a response: { message } \n \n { stackTrace } ")
691708 . WriteErrorLine ( ) ;
692709 }
693710 }
You can’t perform that action at this time.
0 commit comments