![JAR search and dependency download from the Maven repository](/logo.png)
io.github.vipcxj.jasync.spec.catcher.Catcher Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jasync-spec Show documentation
Show all versions of jasync-spec Show documentation
JAsync implements Async-Await fashion for Java just like es and c#.
This library provide the spec of all public api.
package io.github.vipcxj.jasync.spec.catcher;
import io.github.vipcxj.jasync.spec.functional.PromiseFunction;
public class Catcher {
private final Class exceptionType;
private final PromiseFunction reject;
public Catcher(Class exceptionType, PromiseFunction function) {
this.exceptionType = exceptionType;
this.reject = function;
}
public boolean match(Throwable t) {
return t != null && exceptionType.isAssignableFrom(t.getClass());
}
public Class getExceptionType() {
return exceptionType;
}
public PromiseFunction getReject() {
return reject;
}
public static Catcher of(Class exceptionType, PromiseFunction function) {
return new Catcher<>(exceptionType, function);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy