![JAR search and dependency download from the Maven repository](/logo.png)
com.github.dakusui.processstreamer.exceptions.Exceptions Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of processstreamer Show documentation
Show all versions of processstreamer Show documentation
Command line streamer library for Java 8
package com.github.dakusui.processstreamer.exceptions;
import java.util.function.Function;
public enum Exceptions {
;
public static T wrap(Throwable throwable) {
throw wrap(throwable, InternalException::new);
}
public static T wrap(Throwable throwable, Function exceptionFactory) {
if (throwable instanceof Error)
throw (Error) throwable;
if (throwable instanceof RuntimeException)
throw (RuntimeException) throwable;
throw exceptionFactory.apply(throwable);
}
public static IllegalStateException illegalState(Object currentState, String requirement) {
throw new IllegalStateException(String.format("Current state=<%s>, while it should be <%s>", currentState, requirement));
}
public static InternalException illegalException(Throwable t) {
throw new InternalException("This exception shouldn't be thrown here", t);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy