* [jsscripting] Fix bundling of global script & regression from #14135 Fixes the regression from https://github.com/openhab/openhab-addons/pull/14135#issuecomment-1369231126. While working on this, I also noticed that the cache openhab-js does not work because of wrong webpack commandline args in the pom (wrong entrypoint). * [jsscripting] Enable stack logging for IllegalArgumentExceptions * [jsscripting] Upgrade openhab-js to 3.2.4 * [jsscripting] Update README for recent PR Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
This commit is contained in:
@@ -39,6 +39,9 @@ class DebuggingGraalScriptEngine<T extends ScriptEngine & Invocable & AutoClosea
|
||||
@Override
|
||||
public Exception afterThrowsInvocation(Exception e) {
|
||||
Throwable cause = e.getCause();
|
||||
if (cause instanceof IllegalArgumentException) {
|
||||
STACK_LOGGER.error("Failed to execute script:", e);
|
||||
}
|
||||
if (cause instanceof PolyglotException) {
|
||||
STACK_LOGGER.error("Failed to execute script:", cause);
|
||||
}
|
||||
|
||||
@@ -71,7 +71,6 @@ public class OpenhabGraalJSScriptEngine
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(OpenhabGraalJSScriptEngine.class);
|
||||
private static Source GLOBAL_SOURCE;
|
||||
|
||||
static {
|
||||
try {
|
||||
GLOBAL_SOURCE = Source.newBuilder("js", getFileAsReader("node_modules/@jsscripting-globals.js"),
|
||||
@@ -82,7 +81,6 @@ public class OpenhabGraalJSScriptEngine
|
||||
}
|
||||
|
||||
private static Source OPENHAB_JS_SOURCE;
|
||||
|
||||
static {
|
||||
try {
|
||||
OPENHAB_JS_SOURCE = Source
|
||||
@@ -92,7 +90,7 @@ public class OpenhabGraalJSScriptEngine
|
||||
throw new RuntimeException("Failed to load @openhab-globals.js", e);
|
||||
}
|
||||
}
|
||||
private static String OPENHAB_JS_INJECTION_CODE = "Object.assign(this, require('openhab'));";
|
||||
private static final String OPENHAB_JS_INJECTION_CODE = "Object.assign(this, require('openhab'));";
|
||||
|
||||
private static final String REQUIRE_WRAPPER_NAME = "__wraprequire__";
|
||||
/** Final CommonJS search path for our library */
|
||||
|
||||
Reference in New Issue
Block a user