Skip to content

Commit 60b4ba1

Browse files
motiz88facebook-github-bot
authored andcommitted
Always return 0-based columns from parseErrorStack
Summary: Fixes a bug where we were skewing some stack traces by sending 1-based column numbers to the Metro symbolication endpoint, which expects them to be 0-based. This is achieved by subtracting 1 from the column numbers we find in textual stack traces, which are almost universally 1-based in current JS engines. The bug is only noticeable in *some* cases, namely where the column immediately following the correct one is in a different function. NOTE: The behaviour under Hermes was fixed separately, in a previous commit. This fix applies to other engines (e.g. JSC). Changelog: [General] [Fixed] - Fix stack traces showing the wrong function name in some cases Reviewed By: cpojer Differential Revision: D18628230 fbshipit-source-id: 5677803500e45a41c1005496d19c150526af2d07
1 parent 75d03b5 commit 60b4ba1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Libraries/Core/Devtools/parseErrorStack.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ function parseErrorStack(e: ExtendedError): Array<StackFrame> {
5757
? e.stack
5858
: global.HermesInternal
5959
? convertHermesStack(parseHermesStack(e.stack))
60-
: stacktraceParser.parse(e.stack);
60+
: stacktraceParser.parse(e.stack).map(frame => ({
61+
...frame,
62+
column: frame.column != null ? frame.column - 1 : null,
63+
}));
6164

6265
return stack;
6366
}

0 commit comments

Comments
 (0)