From f2922198118d9d6edc56ff5df913c647c8d2fc0c Mon Sep 17 00:00:00 2001 From: alexlamsl Date: Tue, 7 Dec 2021 02:13:42 +0800 Subject: [PATCH] improve sandbox resilience against process aborts --- test/sandbox.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/sandbox.js b/test/sandbox.js index 79b98a23..8ebbaab7 100644 --- a/test/sandbox.js +++ b/test/sandbox.js @@ -295,7 +295,7 @@ function run_code_exec(code, toplevel, timeout) { } catch (e) {} } var match = /\n([^:\s]*Error)(?:: ([\s\S]+?))?\n( at [\s\S]+)\n$/.exec(msg); - if (!match) return details || new Error(msg); + if (!match) return details || new Error("Script execution aborted."); var ex = new global[match[1]](match[2]); ex.stack = ex.stack.slice(0, ex.stack.indexOf(" at ")) + match[3]; if (typeof details == "object") {