mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-26 01:23:49 +01:00
fix tprintf catching errors
This commit is contained in:
parent
983c102123
commit
c88dade19a
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -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")) {
|
||||
|
3
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
3
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@ -3664,9 +3664,10 @@ export interface NS extends Singularity {
|
||||
* @remarks
|
||||
* RAM cost: 0 GB
|
||||
*
|
||||
* @param format - format of the message
|
||||
* @param msg - Value to be printed.
|
||||
*/
|
||||
tprintf(msg: any): void;
|
||||
tprintf(format: string, ...values: any[]): void;
|
||||
|
||||
/**
|
||||
* Clears the script’s logs.
|
||||
|
Loading…
Reference in New Issue
Block a user