fix tprintf catching errors

This commit is contained in:
Olivier Gagnon
2021-11-19 22:58:41 -05:00
parent 983c102123
commit c88dade19a
4 changed files with 8 additions and 4 deletions
+3
View File
@@ -690,6 +690,9 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
Terminal.print(`${workerScript.scriptRef.filename}: ${str}`);
},
tprintf: function (format: any, ...args: any): any {
if (typeof format !== "string") {
throw makeRuntimeErrorMsg("tprintf", "First argument must be string for the format.");
}
const str = vsprintf(format, args);
if (str.startsWith("ERROR") || str.startsWith("FAIL")) {