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

io.atleon.util.Throwing Maven / Gradle / Ivy

There is a newer version: 0.28.3
Show newest version
package io.atleon.util;

import java.util.function.Function;

public final class Throwing {

    private Throwing() {

    }

    public static RuntimeException propagate(Throwable throwable) {
        return propagate(throwable, RuntimeException::new);
    }

    public static RuntimeException
    propagate(Throwable throwable, Function runtimeExceptionWrapper) {
        return throwable instanceof RuntimeException
            ? RuntimeException.class.cast(throwable)
            : runtimeExceptionWrapper.apply(throwable);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy