throw error when trying to pass non-string or number to other scripts

This commit is contained in:
Olivier Gagnon
2021-10-18 14:29:43 -04:00
parent 0419118fb1
commit c4f59d4129
6 changed files with 67 additions and 72 deletions
+3 -3
View File
@@ -646,9 +646,9 @@ export function runScriptFromScript(
return 0;
}
args = args.map((arg) => {
if (typeof arg === "number") return arg;
return arg + ""; // force cast to string
args.forEach((arg) => {
if (typeof arg !== "string" && typeof arg !== "number")
throw new Error("Only strings and numbers can be passed as arguments to otherscripts.");
});
// Check if the script is already running