Skip to content

Commit db4e00a

Browse files
authored
Fixing call stack filtering logic. (#20797) (#20800)
1 parent 042546b commit db4e00a

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

extensions/mssql/src/telemetry/telemetry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export function filterStack(stack: string): string {
5555
for (const line of stack.split("\n")) {
5656
if (frames.length >= 20) break;
5757

58-
const match = line.match(/at (\S+)/);
58+
const match = line.match(/at ((?:async )?\S+)/);
5959
if (!match) continue;
6060

6161
const name = match[1];

extensions/mssql/test/unit/telemetry.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,15 @@ suite("Telemetry Tests", () => {
9090
const filtered = Telemetry.filterStack(stack);
9191
expect(filtered).to.equal("Object.update < UserCode.run");
9292
});
93+
94+
test("filterStack should handle async functions correctly", () => {
95+
const stack = `Error:
96+
at ConnectionManager.connect (/path/to/file.ts:10:10)
97+
at async ObjectExplorerService.createSessionAndExpandNode (/path/to/file.ts:20:20)`;
98+
99+
const filtered = Telemetry.filterStack(stack);
100+
expect(filtered).to.equal(
101+
"ConnectionManager.connect < async ObjectExplorerService.createSessionAndExpandNode",
102+
);
103+
});
93104
});

0 commit comments

Comments
 (0)