Skip to content

Commit

Permalink
fix: pull js stack trace from wrapped NativeScriptExceptions (#1774)
Browse files Browse the repository at this point in the history
  • Loading branch information
rigor789 authored Jul 26, 2023
1 parent 321e6d9 commit 52b7fa2
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions test-app/runtime/src/main/java/com/tns/Runtime.java
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,14 @@ private static String getStackTraceOnly(String content) {
}

public static String getJSStackTrace(Throwable ex) {
if (ex instanceof NativeScriptException) {
return ((NativeScriptException) ex).getIncomingStackTrace();
} else {
return null;
Throwable cause = ex;
while(cause != null) {
if(cause instanceof NativeScriptException) {
return ((NativeScriptException) cause).getIncomingStackTrace();
}
cause = cause.getCause();
}
return null;
}

public static String getStackTraceErrorMessage(Throwable ex) {
Expand Down

0 comments on commit 52b7fa2

Please sign in to comment.