All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.fluentlenium.utils.ExceptionUtil Maven / Gradle / Ivy

package org.fluentlenium.utils;

public final class ExceptionUtil {

    private ExceptionUtil() {
    }

    public static String getCauseMessage(Exception e) {
        String causeMessage = null;
        Throwable cause = e;
        while (true) {
            if (cause.getCause() == null || cause.getCause() == cause) {
                break;
            } else {
                cause = cause.getCause();
                if (cause.getLocalizedMessage() != null) {
                    causeMessage = cause.getLocalizedMessage();
                }
            }
        }
        return causeMessage;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy