Skip to content

Commit 52b7fa2

Browse files
authored
fix: pull js stack trace from wrapped NativeScriptExceptions (#1774)
1 parent 321e6d9 commit 52b7fa2

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

test-app/runtime/src/main/java/com/tns/Runtime.java

+7-4
Original file line numberDiff line numberDiff line change
@@ -283,11 +283,14 @@ private static String getStackTraceOnly(String content) {
283283
}
284284

285285
public static String getJSStackTrace(Throwable ex) {
286-
if (ex instanceof NativeScriptException) {
287-
return ((NativeScriptException) ex).getIncomingStackTrace();
288-
} else {
289-
return null;
286+
Throwable cause = ex;
287+
while(cause != null) {
288+
if(cause instanceof NativeScriptException) {
289+
return ((NativeScriptException) cause).getIncomingStackTrace();
290+
}
291+
cause = cause.getCause();
290292
}
293+
return null;
291294
}
292295

293296
public static String getStackTraceErrorMessage(Throwable ex) {

0 commit comments

Comments
 (0)