Skip to content

Commit

Permalink
fix: avoid silent error on settings update
Browse files Browse the repository at this point in the history
this would cause the program to think dolphin is constantly open
  • Loading branch information
JLaferri committed Aug 10, 2023
1 parent ca0f4a1 commit db020ef
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/dolphin/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@ export class DolphinManager {
// Create the Dolphin instance and start it
this.netplayDolphinInstance = new DolphinInstance(dolphinPath, meleeIsoPath);
this.netplayDolphinInstance.on("close", async (exitCode) => {
await this._updateLauncherSettings(DolphinLaunchType.NETPLAY);
try {
await this._updateLauncherSettings(DolphinLaunchType.NETPLAY);
} catch (e) {
log.error("Error encountered updating launcher settings.", e);
}
this.eventSubject.next({
type: DolphinEventType.CLOSED,
dolphinType: DolphinLaunchType.NETPLAY,
Expand Down Expand Up @@ -122,7 +126,11 @@ export class DolphinManager {
const instance = new DolphinInstance(dolphinPath);
this.netplayDolphinInstance = instance;
instance.on("close", async (exitCode) => {
await this._updateLauncherSettings(launchType);
try {
await this._updateLauncherSettings(launchType);
} catch (e) {
log.error("Error encountered updating launcher settings.", e);
}
this.eventSubject.next({
type: DolphinEventType.CLOSED,
dolphinType: DolphinLaunchType.NETPLAY,
Expand Down Expand Up @@ -218,17 +226,17 @@ export class DolphinManager {
await this._updateLauncherSetting(
this.settingsManager.getRootSlpPath(),
path.normalize(newSettings.replayPath),
this.settingsManager.setRootSlpPath,
(val) => this.settingsManager.setRootSlpPath(val),
);
await this._updateLauncherSetting(
this.settingsManager.getUseMonthlySubfolders(),
newSettings.useMonthlySubfolders,
this.settingsManager.setUseMonthlySubfolders,
(val) => this.settingsManager.setUseMonthlySubfolders(val),
);
await this._updateLauncherSetting(
this.settingsManager.get().settings.enableJukebox,
newSettings.enableJukebox,
this.settingsManager.setEnableJukebox,
(val) => this.settingsManager.setEnableJukebox(val),
);
}

Expand Down

0 comments on commit db020ef

Please sign in to comment.