Skip to content

Commit

Permalink
Just log a warning when trying automatic login, but nodecg-io is alre…
Browse files Browse the repository at this point in the history
…ady loaded

Fixes #365.
If automatic login fails and nodecg-io is not loaded afterwards this will still display a error. This happens when e.g. the password set in the automatic login config is wrong.
However if automatic login fails and nodecg-io is loaded afterwards just a warning will be logged with this PR. This is the case when the dashboard reconnects after a restart and loggs back in.
  • Loading branch information
hlxid committed Dec 22, 2021
1 parent 92555fd commit e427677
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion nodecg-io-core/extension/persistenceManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,17 @@ export class PersistenceManager {
throw loadResult.errorMessage;
}
} catch (err) {
this.nodecg.log.error(`Failed to automatically login: ${err}`);
const logMesssage = `Failed to automatically login: ${err}`;
if (this.isLoaded()) {
// load() threw an error but nodecg-io is currently loaded nonetheless.
// Propably because the a already open dashboard automatically logged in after reconnecting.
// Anyway, nodecg-io is loaded which is what we wanted
this.nodecg.log.warn(logMesssage);
} else {
// Something went wrong and nodecg-io is not loaded.
// This is a real error, the password might be wrong or some other issue.
this.nodecg.log.error(logMesssage);
}
}
}
});
Expand Down

0 comments on commit e427677

Please sign in to comment.