mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-11 02:03:58 +01:00
Merge pull request #1750 from danielyxie/dev
fix tprintf catching errors
This commit is contained in:
commit
41592a199a
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