improved error handling in case of errors during initial tabs loading

This commit is contained in:
zadam 2022-12-14 10:00:33 +01:00
parent 173b28062e
commit 587387dd46

View File

@ -48,6 +48,7 @@ export default class TabManager extends Component {
}
async loadTabs() {
try {
const tabsToOpen = appContext.isMainWindow
? (options.getJson('openTabs') || [])
: [];
@ -66,8 +67,8 @@ export default class TabManager extends Component {
continue;
}
if (!froca.getNoteFromCache(openTab.hoistedNoteId)) {
continue;
if (!(openTab.hoistedNoteId in froca.notes)) {
openTab.hoistedNoteId = 'root';
}
filteredTabs.push(openTab);
@ -104,6 +105,13 @@ export default class TabManager extends Component {
await appContext.tabManager.switchToNoteContext(ntxId, notePath);
}
}
catch (e) {
logError(`Loading tabs '${options.get('openTabs')}' failed: ${e.message}`);
// try to recover
await this.openEmptyTab();
}
}
noteSwitchedEvent({noteContext}) {
if (noteContext.isActive()) {