Skip to content

Commit

Permalink
Merge pull request #3 from ubiquity6/randy/fix-logs-3
Browse files Browse the repository at this point in the history
JSStackTrace -> Ensure lineNumber exists before consuming (facebook#24399)
  • Loading branch information
randy-miller authored Jul 29, 2019
2 parents a2285b1 + 7bccbc4 commit a630a3c
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,26 @@ public static String format(String message, ReadableArray stack) {
stringBuilder
.append(frame.getString("methodName"))
.append("@")
.append(parseFileId(frame))
.append(frame.getInt("lineNumber"));
.append(parseFileId(frame));

if (frame.hasKey("lineNumber") &&
!frame.isNull("lineNumber") &&
frame.getType("lineNumber") == ReadableType.Number) {
stringBuilder
.append(frame.getInt("lineNumber"));
} else {
stringBuilder
.append(-1);
}

if (frame.hasKey("column") &&
!frame.isNull("column") &&
frame.getType("column") == ReadableType.Number) {
stringBuilder
.append(":")
.append(frame.getInt("column"));
}

stringBuilder.append("\n");
}
return stringBuilder.toString();
Expand Down

0 comments on commit a630a3c

Please sign in to comment.