public abstract class ApplicationException extends RuntimeException {
private static final int STACK_WALKER_DEPTH = 12;
public <E extends Enum<E>> ApplicationException() {
super(StackWalker.getInstance(EnumSet.noneOf(Option.class), STACK_WALKER_DEPTH)
.walk(
s -> s.limit(STACK_WALKER_DEPTH).collect(Collectors.toList())
)
.stream()
.map(StackFrame::toString)
.collect(Collectors.joining("\n")));
}
public <E extends Enum<E>> ApplicationException(String message) {
super(message);
}
@Override
public synchronized Throwable fillInStackTrace() {
return this;
}
}