net.diversionmc.error.TryR Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of result Show documentation
Show all versions of result Show documentation
Diversion Network Result type.
package net.diversionmc.error;
@FunctionalInterface
public interface TryR extends Runnable {
void tryRun() throws E;
@SuppressWarnings("OverlyBroadCatchBlock")
default void run() {
try {
tryRun();
} catch (Exception e) {
throw new ResultException(e);
}
}
static TryR of(Runnable f) {
return f::run;
}
}