mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-22 15:43:49 +01:00
better error message for bad args
This commit is contained in:
parent
cdeabfec0e
commit
dea8abef1d
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -651,9 +651,12 @@ export function runScriptFromScript(
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
args.forEach((arg) => {
|
args.forEach((arg, i) => {
|
||||||
if (typeof arg !== "string" && typeof arg !== "number" && typeof arg !== "boolean")
|
if (typeof arg !== "string" && typeof arg !== "number" && typeof arg !== "boolean")
|
||||||
throw new Error("Only strings, numbers, and booleans can be passed as arguments to otherscripts.");
|
throw new Error(
|
||||||
|
"Only strings, numbers, and booleans can be passed as arguments to other scripts.\n" +
|
||||||
|
`${scriptname} argument index ${i} is of type ${typeof arg} and value ${JSON.stringify(arg)}`,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Check if the script is already running
|
// Check if the script is already running
|
||||||
|
Loading…
Reference in New Issue
Block a user