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

io.castled.utils.CastledExceptionUtils Maven / Gradle / Ivy

There is a newer version: 1.0.0
Show newest version
package io.castled.utils;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;

import java.util.Optional;

public class CastledExceptionUtils {

    public static boolean hasMessage(Throwable e, String searchString) {
        Throwable rootThrowable = ExceptionUtils.getRootCause(e);
        return Optional.ofNullable(rootThrowable.getMessage()).filter(message -> StringUtils.containsIgnoreCase(message, searchString)).isPresent();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy