
com.github.kdvolder.util.ExceptionUtil Maven / Gradle / Ivy
package com.github.kdvolder.util;
public class ExceptionUtil {
public static Throwable getDeepestCause(Throwable e) {
Throwable cause = e;
Throwable parent = e.getCause();
while (parent != null && parent != e) {
cause = parent;
parent = cause.getCause();
}
return cause;
}
public static String getMessage(Throwable e) {
Throwable cause = getDeepestCause(e);
String msg = cause.getClass().getSimpleName() + ": " + cause.getMessage();
return msg;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy