diff --git a/packages/core/src/tools/error.ts b/packages/core/src/tools/error.ts index 0d132cd990..768f04c815 100644 --- a/packages/core/src/tools/error.ts +++ b/packages/core/src/tools/error.ts @@ -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 @@ -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!