mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 05:01:07 +00:00
add try-catch around script.main business
This commit is contained in:
@ -90,10 +90,14 @@ public class QJavaScriptExecutor implements QCodeExecutor
|
||||
{
|
||||
%s
|
||||
|
||||
if(script && script.main)
|
||||
try
|
||||
{
|
||||
return (script.main());
|
||||
if(script && script.main)
|
||||
{
|
||||
return (script.main());
|
||||
}
|
||||
}
|
||||
catch(e) { }
|
||||
})();
|
||||
""".formatted(code);
|
||||
|
||||
|
@ -108,16 +108,11 @@ class ExecuteCodeActionTest
|
||||
{
|
||||
OneTestOutput oneTestOutput = testOne(4, """
|
||||
var script = (function (exports) {
|
||||
|
||||
function cooling() {
|
||||
function main() {
|
||||
output.setD(7);
|
||||
return (output);
|
||||
}
|
||||
|
||||
cooling();
|
||||
|
||||
exports.cooling = cooling;
|
||||
|
||||
exports.main = main;
|
||||
return exports;
|
||||
})({});
|
||||
""");
|
||||
|
Reference in New Issue
Block a user