Skip to content

Commit 2509315

Browse files
committed
More comments
1 parent a886e92 commit 2509315

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

packages/telemetry/browser-telemetry/src/stack/StackParser.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,13 @@ export function getSrcLines(
152152
// method.
153153

154154
// Trimmer for non-origin lines. Starts at column 0.
155+
// Non-origin lines are lines which are not the line for a specific stack
156+
// frame, but instead the lines before or after that frame.
157+
// ```
158+
// console.log("before origin"); // non-origin line
159+
// throw new Error("this is the origin"); // origin line
160+
// console.log("after origin); // non-origin line
161+
// ```
155162
const trimmer = (input: string) =>
156163
trimSourceLine(
157164
{
@@ -164,6 +171,7 @@ export function getSrcLines(
164171

165172
const origin = Math.floor(context.length / 2);
166173
return {
174+
// The lines immediately preceeding the origin line.
167175
srcBefore: getLines(origin - options.source.beforeLines, origin, context, trimmer),
168176
srcLine: trimSourceLine(
169177
{
@@ -173,6 +181,7 @@ export function getSrcLines(
173181
context[origin],
174182
inFrame.column || 0,
175183
),
184+
// The lines immediately following the origin line.
176185
srcAfter: getLines(origin + 1, origin + 1 + options.source.afterLines, context, trimmer),
177186
};
178187
}

0 commit comments

Comments
 (0)