File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
java/src/main/java/org/astonbitecode/j4rs/utils Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change 16
16
17
17
import java .io .PrintWriter ;
18
18
import java .io .StringWriter ;
19
+ import java .lang .reflect .InvocationTargetException ;
19
20
import java .util .Arrays ;
20
21
21
22
import org .astonbitecode .j4rs .api .dtos .GeneratedArg ;
23
+ import org .astonbitecode .j4rs .errors .InvocationException ;
22
24
23
25
public class Utils {
24
26
@@ -74,7 +76,12 @@ public static String throwableToString(Throwable throwable) {
74
76
if (throwable != null ) {
75
77
StringWriter sw = new StringWriter ();
76
78
PrintWriter pw = new PrintWriter (sw );
77
- throwable .printStackTrace (pw );
79
+ if (throwable != null && throwable instanceof InvocationException
80
+ && throwable .getCause () != null && throwable .getCause () instanceof InvocationTargetException ) {
81
+ throwable .getCause ().getCause ().printStackTrace (pw );
82
+ } else {
83
+ throwable .printStackTrace (pw );
84
+ }
78
85
return sw .toString ();
79
86
} else {
80
87
return "Cannot create String out of a null Throwable" ;
You can’t perform that action at this time.
0 commit comments