Skip to content

Commit 4398072

Browse files
committed
slightly reduce visual clutter on output
1 parent bbef5e2 commit 4398072

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/core/deno/debug.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ export const getStackAsArray = (
5252
"Could not find quarto.ts in stack trace, is QUARTO_DENO_V8_OPTIONS set with a sufficiently-large stack size?",
5353
);
5454
}
55+
56+
// filter out eventLoopTick
57+
rawStack = rawStack.filter((s) =>
58+
!(s.match(/eventLoopTick/) && s.match(/core\/01_core.js/))
59+
);
5560
if (m && (typeof format !== "undefined") && (format !== "raw")) {
5661
const pathPrefix = m[1];
5762
// first, trim all the path prefixes
@@ -70,19 +75,21 @@ export const getStackAsArray = (
7075
if (m1) {
7176
return {
7277
pos: m1[2],
73-
name: `${m1[1] ?? ""}<main>`,
78+
name: `<main>`,
7479
line: m1[3],
75-
col: m1[4],
80+
// if async, move the column to the start of the actual function name
81+
col: m1[4] + (m1[1] ? 6 : 0),
7682
};
7783
}
7884
// other stack entry? (with parentheses)
7985
const m2 = s.match(/^.*at (async )?(.*) \((src\/.+):(\d+):(\d+)\)$/);
8086
if (m2) {
8187
return {
8288
pos: m2[3],
83-
name: `${m2[1] ?? ""}${m2[2]}`,
89+
name: `${m2[2]}`,
8490
line: m2[4],
85-
col: m2[5],
91+
// if async, move the column to the start of the actual function name
92+
col: m2[5] + (m2[1] ? 6 : 0),
8693
};
8794
}
8895
// links to deno's core?
@@ -93,9 +100,10 @@ export const getStackAsArray = (
93100
if (m3) {
94101
return {
95102
pos: m3[3],
96-
name: `${m3[1] ?? ""}${m3[2]}`,
103+
name: `${m3[2]}`,
97104
line: m3[4],
98-
col: m3[5],
105+
// if async, move the column to the start of the actual function name
106+
col: m3[5] + (m3[1] ? 6 : 0),
99107
};
100108
}
101109
throw new Error(`Unexpected stack entry: ${s}`);

0 commit comments

Comments
 (0)