mirror of
https://github.com/bitwarden/browser
synced 2025-12-21 02:33:46 +00:00
option to allow sync to throw error
This commit is contained in:
@@ -61,7 +61,7 @@ export class SyncService implements SyncServiceAbstraction {
|
||||
await this.storageService.save(Keys.lastSyncPrefix + userId, date.toJSON());
|
||||
}
|
||||
|
||||
async fullSync(forceSync: boolean): Promise<boolean> {
|
||||
async fullSync(forceSync: boolean, allowThrowOnError = false): Promise<boolean> {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user