@@ -96,6 +96,7 @@ const fileStructureTool: vscode.LanguageModelTool<FileStructureInput> = {
9696 const startTime = Date . now ( ) ;
9797 let resultCount = 0 ;
9898 let status = "success" ;
99+ let errorMessage = "" ;
99100 try {
100101 const uri = resolveFileUri ( options . input . uri ) ;
101102 const symbols = await vscode . commands . executeCommand < vscode . DocumentSymbol [ ] > (
@@ -112,13 +113,15 @@ const fileStructureTool: vscode.LanguageModelTool<FileStructureInput> = {
112113 return toResult ( { symbols : result , ...( truncated && { truncated : true } ) } ) ;
113114 } catch ( e ) {
114115 status = "error" ;
116+ errorMessage = e instanceof Error ? e . message : String ( e ) ;
115117 throw e ;
116118 } finally {
117119 sendInfo ( "" , {
118120 operationName : "lmTool.getFileStructure" ,
119121 status,
120- resultCount : String ( resultCount ) ,
121- durationMs : String ( Date . now ( ) - startTime ) ,
122+ ...( errorMessage && { errorMessage } ) ,
123+ resultCount,
124+ durationMs : Date . now ( ) - startTime ,
122125 } ) ;
123126 }
124127 } ,
@@ -169,6 +172,7 @@ const findSymbolTool: vscode.LanguageModelTool<FindSymbolInput> = {
169172 const startTime = Date . now ( ) ;
170173 let resultCount = 0 ;
171174 let status = "success" ;
175+ let errorMessage = "" ;
172176 try {
173177 const symbols = await vscode . commands . executeCommand < vscode . SymbolInformation [ ] > (
174178 "vscode.executeWorkspaceSymbolProvider" , options . input . query ,
@@ -187,13 +191,15 @@ const findSymbolTool: vscode.LanguageModelTool<FindSymbolInput> = {
187191 return toResult ( { results, total : symbols . length } ) ;
188192 } catch ( e ) {
189193 status = "error" ;
194+ errorMessage = e instanceof Error ? e . message : String ( e ) ;
190195 throw e ;
191196 } finally {
192197 sendInfo ( "" , {
193198 operationName : "lmTool.findSymbol" ,
194199 status,
195- resultCount : String ( resultCount ) ,
196- durationMs : String ( Date . now ( ) - startTime ) ,
200+ ...( errorMessage && { errorMessage } ) ,
201+ resultCount,
202+ durationMs : Date . now ( ) - startTime ,
197203 } ) ;
198204 }
199205 } ,
0 commit comments