diff --git a/src/NetscriptWorker.ts b/src/NetscriptWorker.ts index f9db691e8..6e8b49a1b 100644 --- a/src/NetscriptWorker.ts +++ b/src/NetscriptWorker.ts @@ -37,6 +37,7 @@ import { CompleteRunOptions, getRunningScriptsByArgs } from "./Netscript/Netscri import { handleUnknownError } from "./utils/ErrorHandler"; import { isLegacyScript, legacyScriptExtension, resolveScriptFilePath, ScriptFilePath } from "./Paths/ScriptFilePath"; import { root } from "./Paths/Directory"; +import { exceptionAlert } from "./utils/helpers/exceptionAlert"; export const NetscriptPorts = new Map(); @@ -278,8 +279,11 @@ function processNetscript1Imports(code: string, workerScript: WorkerScript): { c export function startWorkerScript(runningScript: RunningScript, server: BaseServer, parent?: WorkerScript): number { if (server.hostname !== runningScript.server) { // Temporarily adding a check here to see if this ever triggers - console.error( - `Tried to launch a worker script on a different server ${server.hostname} than the runningScript's server ${runningScript.server}`, + exceptionAlert( + new Error( + `Tried to launch a worker script on a different server ${server.hostname} than the runningScript's server ${runningScript.server}`, + ), + true, ); return 0; } diff --git a/src/Server/ServerHelpers.ts b/src/Server/ServerHelpers.ts index a71870e61..81fafb06f 100644 --- a/src/Server/ServerHelpers.ts +++ b/src/Server/ServerHelpers.ts @@ -11,6 +11,7 @@ import { Server as IServer } from "@nsdefs"; import { workerScripts } from "../Netscript/WorkerScripts"; import { killWorkerScriptByPid } from "../Netscript/killWorkerScript"; import { serverMetadata } from "./data/servers"; +import { exceptionAlert } from "../utils/helpers/exceptionAlert"; /** * Constructs a new server, while also ensuring that the new server @@ -206,9 +207,16 @@ export function prestigeHomeComputer(homeComp: Server): void { homeComp.messages.push(LiteratureName.HackersStartingHandbook); if (homeComp.runningScriptMap.size !== 0) { // Temporary verbose logging section to gather data on a bug - console.error("Some runningScripts were still present on home during prestige"); + exceptionAlert( + new Error( + `Some runningScripts were still present on home during prestige. runningScripts: ${Array.from( + homeComp.runningScriptMap.keys(), + )}`, + ), + true, + ); for (const [scriptKey, byPidMap] of homeComp.runningScriptMap) { - console.error(`script key: ${scriptKey}: ${byPidMap.size} scripts`); + console.error(`script key: ${scriptKey}: ${byPidMap.size} scripts`, byPidMap); for (const pid of byPidMap.keys()) { if (workerScripts.has(pid)) killWorkerScriptByPid(pid); } diff --git a/src/utils/SaveDataMigrationUtils.ts b/src/utils/SaveDataMigrationUtils.ts index ae9fae9dc..5183f48d0 100644 --- a/src/utils/SaveDataMigrationUtils.ts +++ b/src/utils/SaveDataMigrationUtils.ts @@ -480,7 +480,7 @@ Error: ${e}`, ); } if (ver < 33) { - // 2.3.2 fixed what should be the last issue with scripts having the wrong server assigned.. + // 2.4.0 fixed what should be the last issue with scripts having the wrong server assigned for (const server of GetAllServers()) { for (const script of server.scripts.values()) { if (script.server !== server.hostname) {