feat: 撤销异常拦截 抛到外层

This commit is contained in:
coding 2017-11-02 17:36:32 +00:00
parent 0272518f72
commit 236955ddea

View File

@ -12,6 +12,7 @@ import java.nio.file.Path;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import lombok.SneakyThrows;
import pw.yumc.YumCore.engine.MiaoScriptEngine;
/**
@ -31,8 +32,8 @@ public class ScriptEngine {
enableEngine();
}
@SneakyThrows
public void enableEngine() {
try {
ScriptEngineManager manager = new ScriptEngineManager(null);
this.engine = new MiaoScriptEngine(manager, "nashorn");
this.engine.put("base", new Base());
@ -44,17 +45,11 @@ public class ScriptEngine {
this.engine.eval(new InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream("bios.js")));
}
engine.invokeFunction("boot", root, logger);
} catch (Exception e) {
// logger.log(Level.SEVERE, "MiaoScript 启动失败!", e);
}
}
@SneakyThrows
public void disableEngine() {
try {
engine.invokeFunction("disable");
} catch (ScriptException | NoSuchMethodException e) {
// logger.log(Level.SEVERE, "MiaoScript 关闭失败!", e);
}
}
public MiaoScriptEngine getEngine() {