All Manuals > LispWorks® User Guide and Reference Manual > 39 The LW-JI Package

get-throwable-backtrace-strings Function

Summary

Returns the Java backtrace of a throwable.

Package

lw-ji

Signature

get-throwable-backtrace-strings throwable-jobject => backtrace-list

Arguments
throwable-jobject
A jobject or an instance of standard-java-object.
Values
backtrace-list
A list of Lisp strings.
Description

The function get-throwable-backtrace-strings returns a list of strings containing a Java backtrace based on the information in throwable-jobject, which is typically an exception thrown by some Java method. If throwable-jobject contains a cause (that is the Java method getCause returns non-null), then get-throwable-backtrace-strings recurses to generate a backtrace for the cause as well.

throwable-jobject must be either a jobject of Java class throwable or an instance of standard-java-object associated with such jobject.

The result backtrace-list is a list of strings, each string representing a StackTraceElement in the stack trace of throwable-jobject. Recursive backtraces are preceded by a string saying "CAUSED BY:".

Note that if you have a java-exception object, then it already contains the backtrace which can be accessed by java-exception-java-backtrace. You need get-throwable-backtrace-strings only when you deal with throwable objects directly.

See also

java-exception
java-exception-java-backtrace


LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:46