diff --git a/packages/host/src/Host.ts b/packages/host/src/Host.ts index 7e778c32..b096a889 100644 --- a/packages/host/src/Host.ts +++ b/packages/host/src/Host.ts @@ -74,6 +74,7 @@ async function discoverInstances(instancesDir: string) { return instances; } +// Requests that wake up the instance is responsible for updating the instance state in case of errors. const instanceStartingMessages = new Set([ lib.InstanceStartRequest.name, lib.InstanceLoadScenarioRequest.name, diff --git a/packages/host/src/Instance.ts b/packages/host/src/Instance.ts index 952470be..782b26a2 100644 --- a/packages/host/src/Instance.ts +++ b/packages/host/src/Instance.ts @@ -637,9 +637,10 @@ end`.replace(/\r?\n/g, " "); } async init(pluginInfos: lib.PluginNodeEnvInfo[]) { + // After changing the status this function is responsible for calling notifyExit if it throws. this.notifyStatus("starting"); - const factorioVersions = await this.sendTo("controller", new lib.FactorioVersionsRequest()); try { + const factorioVersions = await this.sendTo("controller", new lib.FactorioVersionsRequest()); await this._loadStats(); await this.server.checkForUpdates(factorioVersions); await this.server.init();