diff --git a/src/abstractions/sync.service.ts b/src/abstractions/sync.service.ts index 264e6ecbf9..ad6eb498e8 100644 --- a/src/abstractions/sync.service.ts +++ b/src/abstractions/sync.service.ts @@ -8,7 +8,7 @@ export abstract class SyncService { getLastSync: () => Promise; setLastSync: (date: Date) => Promise; - fullSync: (forceSync: boolean) => Promise; + fullSync: (forceSync: boolean, allowThrowOnError?: boolean) => Promise; syncUpsertFolder: (notification: SyncFolderNotification, isEdit: boolean) => Promise; syncDeleteFolder: (notification: SyncFolderNotification) => Promise; syncUpsertCipher: (notification: SyncCipherNotification, isEdit: boolean) => Promise; diff --git a/src/services/sync.service.ts b/src/services/sync.service.ts index 6db32a6e6f..4e98d785ee 100644 --- a/src/services/sync.service.ts +++ b/src/services/sync.service.ts @@ -61,7 +61,7 @@ export class SyncService implements SyncServiceAbstraction { await this.storageService.save(Keys.lastSyncPrefix + userId, date.toJSON()); } - async fullSync(forceSync: boolean): Promise { + async fullSync(forceSync: boolean, allowThrowOnError = false): Promise { this.syncStarted(); const isAuthenticated = await this.userService.isAuthenticated(); if (!isAuthenticated) { @@ -95,7 +95,11 @@ export class SyncService implements SyncServiceAbstraction { await this.setLastSync(now); return this.syncCompleted(true); } catch (e) { - return this.syncCompleted(false); + if (allowThrowOnError) { + throw e; + } else { + return this.syncCompleted(false); + } } }