File tree 5 files changed +24
-1
lines changed
5 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -695,6 +695,7 @@ export class Core {
695
695
"indexing_error" ,
696
696
{
697
697
error : update . desc ,
698
+ stack : update . debugInfo ,
698
699
} ,
699
700
false ,
700
701
) ;
Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ export interface IndexingProgressUpdate {
39
39
desc : string ;
40
40
shouldClearIndexes ?: boolean ;
41
41
status : "loading" | "indexing" | "done" | "failed" | "paused" | "disabled" ;
42
+ debugInfo ?: string ;
42
43
}
43
44
44
45
export type PromptTemplate =
Original file line number Diff line number Diff line change
1
+ import * as fs from "fs/promises" ;
1
2
import { ConfigHandler } from "../config/ConfigHandler.js" ;
2
3
import { IContinueServerClient } from "../continueServer/interface.js" ;
3
4
import { IDE , IndexTag , IndexingProgressUpdate } from "../index.js" ;
5
+ import { extractMinimalStackTraceInfo } from "../util/extractMinimalStackTraceInfo.js" ;
4
6
import { getIndexSqlitePath , getLanceDbPath } from "../util/paths.js" ;
5
7
import { ChunkCodebaseIndex } from "./chunk/ChunkCodebaseIndex.js" ;
6
8
import { CodeSnippetsCodebaseIndex } from "./CodeSnippetsIndex.js" ;
@@ -13,7 +15,6 @@ import {
13
15
RefreshIndexResults ,
14
16
} from "./types.js" ;
15
17
import { walkDirAsync } from "./walkDir.js" ;
16
- import * as fs from "fs/promises" ;
17
18
18
19
export class PauseToken {
19
20
constructor ( private _paused : boolean ) { }
@@ -259,6 +260,7 @@ export class CodebaseIndexer {
259
260
progress : 0 ,
260
261
desc : `Indexing failed: ${ err } ` ,
261
262
status : "failed" ,
263
+ debugInfo : extractMinimalStackTraceInfo ( ( err as any ) ?. stack ) ,
262
264
} ;
263
265
}
264
266
@@ -282,6 +284,7 @@ export class CodebaseIndexer {
282
284
desc : errMsg ,
283
285
status : "failed" ,
284
286
shouldClearIndexes,
287
+ debugInfo : extractMinimalStackTraceInfo ( err . stack ) ,
285
288
} ;
286
289
}
287
290
Original file line number Diff line number Diff line change
1
+ /**
2
+ * It's helpful to know what functions errors occur in, but absolute
3
+ * file paths are sensitive information, so we want to remove them.
4
+ * @param stack The stack trace to extract minimal information from.
5
+ * @returns A string containing the minimal stack trace information.
6
+ */
7
+ export function extractMinimalStackTraceInfo ( stack : unknown ) : string {
8
+ if ( typeof stack !== "string" ) return "" ;
9
+ const lines = stack . split ( "\n" ) ;
10
+ const minimalLines = lines . filter ( ( line ) => {
11
+ return line . trimStart ( ) . startsWith ( "at " ) && ! line . includes ( "node_modules" ) ;
12
+ } ) ;
13
+ return minimalLines
14
+ . map ( ( line ) => line . trimStart ( ) . replace ( "at " , "" ) . split ( " (" ) . slice ( 0 , 1 ) )
15
+ . join ( ", " ) ;
16
+ }
Original file line number Diff line number Diff line change 1
1
import { FromWebviewProtocol , ToWebviewProtocol } from "core/protocol" ;
2
+ import { extractMinimalStackTraceInfo } from "core/util/extractMinimalStackTraceInfo" ;
2
3
import { Message } from "core/util/messenger" ;
3
4
import { Telemetry } from "core/util/posthog" ;
4
5
import fs from "node:fs" ;
@@ -159,6 +160,7 @@ export class VsCodeWebviewProtocol
159
160
{
160
161
messageType : msg . messageType ,
161
162
errorMsg : message . split ( "\n\n" ) [ 0 ] ,
163
+ stack : extractMinimalStackTraceInfo ( e . stack ) ,
162
164
} ,
163
165
false ,
164
166
) ;
You can’t perform that action at this time.
0 commit comments