Skip to content

Commit 149c1d8

Browse files
author
shehabeldeenibrahim
committed
Fixed parseErrorStackLib params based on RN Version in errorHandler
1 parent e8676d3 commit 149c1d8

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

utils/InstabugUtils.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,17 @@ export const captureJsErrors = () => {
5252
}
5353

5454
function errorHandler(e, isFatal) {
55-
let jsStackTrace = parseErrorStackLib(e);
55+
let jsStackTrace;
56+
if (Platform.hasOwnProperty("constants")) {
57+
// RN version >= 0.63
58+
if (Platform.constants.reactNativeVersion.minor >= 64)
59+
// RN version >= 0.64 -> Stacktrace as string
60+
jsStackTrace = parseErrorStackLib(e.stack);
61+
// RN version == 0.63 -> Stacktrace as string
62+
else jsStackTrace = parseErrorStackLib(e);
63+
}
64+
// RN version < 0.63 -> Stacktrace as string
65+
else jsStackTrace = parseErrorStackLib(e);
5666

5767
//JSON object to be sent to the native SDK
5868
var jsonObject = {

0 commit comments

Comments
 (0)