Skip to content

Commit

Permalink
#98: Do not include the j4rs parts of the stacktrace
Browse files Browse the repository at this point in the history
astonbitecode committed Apr 29, 2024
1 parent c8427f5 commit d287785
Showing 2 changed files with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion java/src/main/java/org/astonbitecode/j4rs/utils/Utils.java
Original file line number Diff line number Diff line change
@@ -16,9 +16,11 @@

import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;

import org.astonbitecode.j4rs.api.dtos.GeneratedArg;
import org.astonbitecode.j4rs.errors.InvocationException;

public class Utils {

@@ -74,7 +76,12 @@ public static String throwableToString(Throwable throwable) {
if (throwable != null) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
throwable.printStackTrace(pw);
if (throwable != null && throwable instanceof InvocationException
&& throwable.getCause() != null && throwable.getCause() instanceof InvocationTargetException) {
throwable.getCause().getCause().printStackTrace(pw);
} else {
throwable.printStackTrace(pw);
}
return sw.toString();
} else {
return "Cannot create String out of a null Throwable";
Binary file modified rust/jassets/j4rs-0.19.0-SNAPSHOT-jar-with-dependencies.jar
Binary file not shown.

0 comments on commit d287785

Please sign in to comment.