mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2025-12-13 09:45:56 +00:00
Fixed:
- Fixed lack of error handling.
This commit is contained in:
@@ -6,6 +6,7 @@ import ObsidianLiveSyncPlugin from "./main";
|
||||
import { DIFF_DELETE, DIFF_EQUAL, DIFF_INSERT, diff_match_patch } from "diff-match-patch";
|
||||
import { LoadedEntry, LOG_LEVEL } from "./lib/src/types";
|
||||
import { Logger } from "./lib/src/logger";
|
||||
import { isErrorOfMissingDoc } from "./lib/src/utils_couchdb";
|
||||
import { getDocData } from "./lib/src/utils";
|
||||
|
||||
export class DocumentHistoryModal extends Modal {
|
||||
@@ -35,13 +36,13 @@ export class DocumentHistoryModal extends Modal {
|
||||
const db = this.plugin.localDatabase;
|
||||
try {
|
||||
const w = await db.localDatabase.get(path2id(this.file), { revs_info: true });
|
||||
this.revs_info = w._revs_info.filter((e) => e.status == "available");
|
||||
this.revs_info = w._revs_info.filter((e) => e?.status == "available");
|
||||
this.range.max = `${this.revs_info.length - 1}`;
|
||||
this.range.value = this.range.max;
|
||||
this.fileInfo.setText(`${this.file} / ${this.revs_info.length} revisions`);
|
||||
await this.loadRevs();
|
||||
} catch (ex) {
|
||||
if (ex.status && ex.status == 404) {
|
||||
if (isErrorOfMissingDoc(ex)) {
|
||||
this.range.max = "0";
|
||||
this.range.value = "";
|
||||
this.range.disabled = true;
|
||||
|
||||
2
src/lib
2
src/lib
Submodule src/lib updated: 2567497fa6...9e993fd984
@@ -15,7 +15,7 @@ import { decrypt, encrypt, tryDecrypt } from "./lib/src/e2ee_v2";
|
||||
const isDebug = false;
|
||||
|
||||
import { InputStringDialog, PluginDialogModal, PopoverSelectString } from "./dialogs";
|
||||
import { isCloudantURI } from "./lib/src/utils_couchdb";
|
||||
import { isCloudantURI, isErrorOfMissingDoc } from "./lib/src/utils_couchdb";
|
||||
import { getGlobalStore, observeStores } from "./lib/src/store";
|
||||
import { lockStore, logMessageStore, logStore } from "./lib/src/stores";
|
||||
import { NewNotice, setNoticeClass, WrappedNotice } from "./lib/src/wrapper";
|
||||
@@ -2132,7 +2132,7 @@ export default class ObsidianLiveSyncPlugin extends Plugin {
|
||||
data: data
|
||||
};
|
||||
} catch (ex) {
|
||||
if (ex.status && ex.status == 404) {
|
||||
if (isErrorOfMissingDoc(ex)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user