Skip to content

Commit

Permalink
πŸ‘Œ Update handling stack trace creation comments
Browse files Browse the repository at this point in the history
  • Loading branch information
amortemousque committed Jun 16, 2021
1 parent 33c8837 commit e2bb68c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/core/src/tools/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,13 @@ export function formatErrorMessage(stack: StackTrace) {
```
*/
export function createHandlingStackTrace(): StackTrace {
const internalFrameToSkip = 2 // Skip the two RUM internal frames in order to keep only the user calls
/**
* Skip the two internal frames:
* - SDK API (console.error, ...)
* - this function
* in order to keep only the user calls
*/
const internalFramesToSkip = 2
const error = new Error()
let stackTrace: StackTrace

Expand All @@ -104,7 +110,7 @@ export function createHandlingStackTrace(): StackTrace {

callMonitored(() => {
stackTrace = computeStackTrace(error)
stackTrace.stack = stackTrace.stack.slice(internalFrameToSkip)
stackTrace.stack = stackTrace.stack.slice(internalFramesToSkip)
})

return stackTrace!
Expand Down

0 comments on commit e2bb68c

Please sign in to comment.