I am inheriting Exception class for creating my own exception. Something like the code below
public class ApplicationException extends Exception {
ApplicationException(String errorMessage) {
super(errorMessage);
}
}
The problem is that the stacktrace is always empty. The below code will write nothing to the console.
ApplicationException(String errorMessage) {
super(errorMessage);
System.out.println(this.getStackTrace());
}
I don't understand why it is empty because the Throwable(String)
is calling fillInStackTrace method
. Is there a way to fill in Stack or is it something else that I should do?