Use remote vm for better error messages

This commit is contained in:
2022-09-26 03:01:16 -04:00
parent 0c80358e5f
commit f5003fa3c4
4 changed files with 24 additions and 3 deletions
+1
View File
@@ -36,6 +36,7 @@ export * as filesystem from "./filesystem";
export {default as https} from "./https";
export * as electron from "./electron";
export * as crypto from "./crypto";
export * as vm from "./vm";
// We can expose that without any issues.
export * as path from "path";
+14
View File
@@ -0,0 +1,14 @@
import vm from "vm";
export function compileFunction(code, params = [], options = {}) {
try {
return vm.compileFunction(code, params, options);
}
catch (error) {
return {
name: error.name,
message: error.message,
stack: error.stack
};
}
}