mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2025-12-13 17:55:56 +00:00
Print exception on failure in certain cases
This commit is contained in:
@@ -357,7 +357,7 @@ export class LocalPouchDB {
|
|||||||
Logger(childrens);
|
Logger(childrens);
|
||||||
}
|
}
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
Logger(`Something went wrong on reading elements of ${obj._id} from database.`, LOG_LEVEL.NOTICE);
|
Logger(`Something went wrong on reading elements of ${obj._id} from database:`, LOG_LEVEL.NOTICE);
|
||||||
Logger(ex, LOG_LEVEL.VERBOSE);
|
Logger(ex, LOG_LEVEL.VERBOSE);
|
||||||
this.corruptedEntries[obj._id] = obj;
|
this.corruptedEntries[obj._id] = obj;
|
||||||
return false;
|
return false;
|
||||||
@@ -388,7 +388,7 @@ export class LocalPouchDB {
|
|||||||
Logger(`Missing document content!, could not read ${obj._id} from database.`, LOG_LEVEL.NOTICE);
|
Logger(`Missing document content!, could not read ${obj._id} from database.`, LOG_LEVEL.NOTICE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Logger(`Something went wrong on reading ${obj._id} from database.`, LOG_LEVEL.NOTICE);
|
Logger(`Something went wrong on reading ${obj._id} from database:`, LOG_LEVEL.NOTICE);
|
||||||
Logger(ex);
|
Logger(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -594,7 +594,7 @@ export class LocalPouchDB {
|
|||||||
try {
|
try {
|
||||||
pieceData.data = await decrypt(pieceData.data, this.settings.passphrase);
|
pieceData.data = await decrypt(pieceData.data, this.settings.passphrase);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Logger("Decode failed !");
|
Logger("Decode failed!");
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -667,8 +667,8 @@ export class LocalPouchDB {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
Logger("ERROR ON SAVING LEAVES ");
|
Logger("ERROR ON SAVING LEAVES:", LOG_LEVEL.NOTICE);
|
||||||
Logger(ex);
|
Logger(ex, LOG_LEVEL.NOTICE);
|
||||||
saved = false;
|
saved = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -822,7 +822,7 @@ export class LocalPouchDB {
|
|||||||
}
|
}
|
||||||
const dbret = await connectRemoteCouchDB(uri, auth);
|
const dbret = await connectRemoteCouchDB(uri, auth);
|
||||||
if (typeof dbret === "string") {
|
if (typeof dbret === "string") {
|
||||||
Logger(`could not connect to ${uri}:${dbret}`, LOG_LEVEL.NOTICE);
|
Logger(`could not connect to ${uri}: ${dbret}`, LOG_LEVEL.NOTICE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -932,8 +932,8 @@ export class LocalPouchDB {
|
|||||||
}
|
}
|
||||||
this.updateInfo();
|
this.updateInfo();
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
Logger("Replication callback error");
|
Logger("Replication callback error", LOG_LEVEL.NOTICE);
|
||||||
Logger(ex);
|
Logger(ex, LOG_LEVEL.NOTICE);
|
||||||
}
|
}
|
||||||
// re-connect to retry with original setting
|
// re-connect to retry with original setting
|
||||||
if (retrying) {
|
if (retrying) {
|
||||||
@@ -1032,8 +1032,8 @@ export class LocalPouchDB {
|
|||||||
notice.setMessage(`Replication pulled:${e.docs_read}`);
|
notice.setMessage(`Replication pulled:${e.docs_read}`);
|
||||||
}
|
}
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
Logger("Replication callback error");
|
Logger("Replication callback error", LOG_LEVEL.NOTICE);
|
||||||
Logger(ex);
|
Logger(ex, LOG_LEVEL.NOTICE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.syncStatus = "COMPLETED";
|
this.syncStatus = "COMPLETED";
|
||||||
@@ -1046,7 +1046,8 @@ export class LocalPouchDB {
|
|||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
this.syncStatus = "ERRORED";
|
this.syncStatus = "ERRORED";
|
||||||
this.updateInfo();
|
this.updateInfo();
|
||||||
Logger("Pulling Replication error", LOG_LEVEL.NOTICE);
|
Logger("Pulling Replication error:", LOG_LEVEL.NOTICE);
|
||||||
|
Logger(ex, LOG_LEVEL.NOTICE);
|
||||||
this.cancelHandler(replicate);
|
this.cancelHandler(replicate);
|
||||||
this.syncHandler = this.cancelHandler(this.syncHandler);
|
this.syncHandler = this.cancelHandler(this.syncHandler);
|
||||||
if (notice != null) notice.hide();
|
if (notice != null) notice.hide();
|
||||||
@@ -1087,7 +1088,8 @@ export class LocalPouchDB {
|
|||||||
Logger("Remote Database Destroyed", LOG_LEVEL.NOTICE);
|
Logger("Remote Database Destroyed", LOG_LEVEL.NOTICE);
|
||||||
await this.tryCreateRemoteDatabase(setting);
|
await this.tryCreateRemoteDatabase(setting);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
Logger("something happend on Remote Database Destory", LOG_LEVEL.NOTICE);
|
Logger("Something happened on Remote Database Destory:", LOG_LEVEL.NOTICE);
|
||||||
|
Logger(ex, LOG_LEVEL.NOTICE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async tryCreateRemoteDatabase(setting: ObsidianLiveSyncSettings) {
|
async tryCreateRemoteDatabase(setting: ObsidianLiveSyncSettings) {
|
||||||
|
|||||||
Reference in New Issue
Block a user