mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-19 12:45:45 +01:00
IPVGO: Improve error logging to include stacktraces (#1212)
This commit is contained in:
parent
1ad6f9f310
commit
057ccc2a2b
@ -12,7 +12,6 @@ import {
|
|||||||
simpleBoardFromBoard,
|
simpleBoardFromBoard,
|
||||||
} from "../boardAnalysis/boardAnalysis";
|
} from "../boardAnalysis/boardAnalysis";
|
||||||
import { getScore, resetWinstreak } from "../boardAnalysis/scoring";
|
import { getScore, resetWinstreak } from "../boardAnalysis/scoring";
|
||||||
import { WorkerScript } from "../../Netscript/WorkerScript";
|
|
||||||
import { WHRNG } from "../../Casino/RNG";
|
import { WHRNG } from "../../Casino/RNG";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -437,13 +436,6 @@ export function cheatSuccessChance(cheatCount: number) {
|
|||||||
return Math.max(Math.min(0.6 * cheatCountScalar * Player.mults.crime_success + sourceFileBonus, 1), 0);
|
return Math.max(Math.min(0.6 * cheatCountScalar * Player.mults.crime_success + sourceFileBonus, 1), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Throw a runtime error that halts the player's script
|
|
||||||
*/
|
|
||||||
export function throwError(ws: WorkerScript, errorMessage: string) {
|
|
||||||
throw `RUNTIME ERROR\n${ws.name}@${ws.hostname} (PID - ${ws.pid})\n\n ${errorMessage}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempts to remove an existing router from the board. Can fail. If failed, can immediately end the game
|
* Attempts to remove an existing router from the board. Can fail. If failed, can immediately end the game
|
||||||
*/
|
*/
|
||||||
|
@ -22,14 +22,16 @@ import {
|
|||||||
handlePassTurn,
|
handlePassTurn,
|
||||||
makePlayerMove,
|
makePlayerMove,
|
||||||
resetBoardState,
|
resetBoardState,
|
||||||
throwError,
|
|
||||||
validateMove,
|
validateMove,
|
||||||
validateTurn,
|
validateTurn,
|
||||||
} from "../Go/effects/netscriptGoImplementation";
|
} from "../Go/effects/netscriptGoImplementation";
|
||||||
import { getEnumHelper } from "../utils/EnumHelper";
|
import { getEnumHelper } from "../utils/EnumHelper";
|
||||||
|
import { errorMessage } from "../Netscript/ErrorMessages";
|
||||||
|
|
||||||
const logger = (ctx: NetscriptContext) => (message: string) => helpers.log(ctx, () => message);
|
const logger = (ctx: NetscriptContext) => (message: string) => helpers.log(ctx, () => message);
|
||||||
const error = (ctx: NetscriptContext) => (message: string) => throwError(ctx.workerScript, message);
|
const error = (ctx: NetscriptContext) => (message: string) => {
|
||||||
|
throw errorMessage(ctx, message);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Go API implementation
|
* Go API implementation
|
||||||
|
Loading…
Reference in New Issue
Block a user