Skip to content

Commit

Permalink
ref(utils): add stripSentryFramesAndReverse comment
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasBa committed Mar 10, 2023
1 parent d0cafb5 commit d59a812
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/utils/src/stacktrace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ export function stackParserFromStackParserOptions(stackParser: StackParser | Sta
}

/**
* Removes Sentry frames from the top and bottom of the stack if present and enforces a limit of max number of frames.
* Assumes stack input is ordered from top to bottom and returns the reverse representation so call site of the
* function that caused the crash is the last frame in the array.
* @hidden
*/
export function stripSentryFramesAndReverse(stack: ReadonlyArray<StackFrame>): StackFrame[] {
Expand All @@ -79,7 +82,6 @@ export function stripSentryFramesAndReverse(stack: ReadonlyArray<StackFrame>): S
localStack.pop();
}

// The frame where the crash happened, should be the last entry in the array
return localStack.map(frame => ({
...frame,
filename: frame.filename || localStack[0].filename,
Expand Down

0 comments on commit d59a812

Please sign in to comment.