catch JSON stringify error, #4310

This commit is contained in:
zadam
2023-10-05 21:54:59 +02:00
parent 1dc3fafcbf
commit 86d62866f2
3 changed files with 83 additions and 78 deletions

View File

@@ -151,9 +151,14 @@ async function pullChanges(syncContext) {
if (entityChanges.length === 0) {
break;
} else {
const sizeInKb = Math.round(JSON.stringify(resp).length / 1024);
try { // https://github.com/zadam/trilium/issues/4310
const sizeInKb = Math.round(JSON.stringify(resp).length / 1024);
log.info(`Sync ${logMarkerId}: Pulled ${entityChanges.length} changes in ${sizeInKb} KB, starting at entityChangeId=${lastSyncedPull} in ${pulledDate - startDate}ms and applied them in ${Date.now() - pulledDate}ms, ${outstandingPullCount} outstanding pulls`);
log.info(`Sync ${logMarkerId}: Pulled ${entityChanges.length} changes in ${sizeInKb} KB, starting at entityChangeId=${lastSyncedPull} in ${pulledDate - startDate}ms and applied them in ${Date.now() - pulledDate}ms, ${outstandingPullCount} outstanding pulls`);
}
catch (e) {
log.error(`Error occurred ${e.message} ${e.stack}`);
}
}
}