Database exception handling

This commit is contained in:
Mo Bitar
2020-03-25 22:04:14 -05:00
parent a80a94de5e
commit 9d6c32890a
6 changed files with 96 additions and 98 deletions

View File

@@ -74,7 +74,6 @@ class EditorCtrl extends PureCtrl {
$onInit() {
super.$onInit();
this.addSyncStatusObserver();
this.registerKeyboardShortcuts();
}
@@ -136,6 +135,11 @@ class EditorCtrl extends PureCtrl {
if (this.state.note.dirty) {
this.showErrorStatus();
}
} else if (eventName === ApplicationEvents.LocalDatabaseWriteError) {
this.showErrorStatus({
message: "Offline Saving Issue",
desc: "Changes not saved"
});
}
}
@@ -256,21 +260,6 @@ class EditorCtrl extends PureCtrl {
this.reloadComponentContext();
}
addSyncStatusObserver() {
/** @todo */
// this.syncStatusObserver = syncManager.
// registerSyncStatusObserver((status) => {
// if (status.localError) {
// this.$timeout(() => {
// this.showErrorStatus({
// message: "Offline Saving Issue",
// desc: "Changes not saved"
// });
// }, 500);
// }
// });
}
editorForNote(note) {
return this.application.componentManager.editorForNote(note);
}
@@ -421,13 +410,9 @@ class EditorCtrl extends PureCtrl {
saveError: false,
syncTakingTooLong: false
});
let status = "All changes saved";
if (this.application.noAccount()) {
status += " (offline)";
}
this.setStatus(
{ message: status }
);
this.setStatus({
message: 'All changes saved',
});
}
showErrorStatus(error) {