🐛 Fix issue that DB init errors did not get caught #1269

This commit is contained in:
Jan Oberhauser 2020-12-24 09:06:43 +01:00
parent 75cca869b4
commit ecdcc0b522

View file

@ -121,10 +121,16 @@ export class Start extends Command {
const { flags } = this.parse(Start);
// Wrap that the process does not close but we can still use async
(async () => {
await (async () => {
try {
// Start directly with the init of the database to improve startup time
const startDbInitPromise = Db.init();
const startDbInitPromise = Db.init().catch(error => {
console.error(`There was an error initializing DB: ${error.message}`);
processExistCode = 1;
// @ts-ignore
process.emit('SIGINT');
});
// Make sure the settings exist
const userSettings = await UserSettings.prepareUserSettings();