mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-16 14:28:36 +02:00
fix typechecking and documentation for attempt
This commit is contained in:
@@ -33,10 +33,11 @@ export function NetscriptCodingContract(player: IPlayer, workerScript: WorkerScr
|
||||
const hostname = ctx.helper.string("hostname", _hostname);
|
||||
const contract = getCodingContract(ctx, "attempt", hostname, filename);
|
||||
|
||||
if (typeof answer !== "number" && typeof answer !== "string" && !Array.isArray(answer))
|
||||
throw new Error("The answer provided was not a number, string, or array");
|
||||
|
||||
// Convert answer to string.
|
||||
const answerStr = JSON.stringify(answer);
|
||||
if (answerStr === undefined) throw new Error("The provided answer could not be stringified");
|
||||
|
||||
const creward = contract.reward;
|
||||
if (creward === null) throw new Error("Somehow solved a contract that didn't have a reward");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user