feat: 撤销异常拦截 抛到外层
This commit is contained in:
parent
0272518f72
commit
236955ddea
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user