com.github.panhongan.commons.ExceptionalActionWrapper Maven / Gradle / Ivy
package com.github.panhongan.commons;
import java.util.concurrent.Callable;
/**
* @author panhongan
* @since 2020.9.10
* @version 1.0
*/
public class ExceptionalActionWrapper {
public static T run(Callable callable) {
try {
return callable.call();
} catch (MysqlConveyerException e) {
throw e;
} catch (Exception e) {
throw new MysqlConveyerException(e);
}
}
public static void run(Runnable runnable) {
Callable callable = () -> {
runnable.run();
return null;
};
run(callable);
}
}