Use remote vm for better error messages
This commit is contained in:
@@ -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";
|
||||
|
||||
@@ -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
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user