Skip to content

Commit 2e66ecb

Browse files
committed
1 parent 9fab9da commit 2e66ecb

2 files changed

Lines changed: 16 additions & 11 deletions

File tree

src/vs/platform/userDataSync/common/userDataAutoSyncService.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,24 +63,19 @@ export class UserDataAutoSyncService extends Disposable implements IUserDataAuto
6363
this.resetFailures();
6464
} catch (e) {
6565
const error = UserDataSyncError.toUserDataSyncError(e);
66-
if (error.code === UserDataSyncErrorCode.TurnedOff) {
66+
if (error.code === UserDataSyncErrorCode.TurnedOff || error.code === UserDataSyncErrorCode.SessionExpired) {
6767
this.logService.info('Auto Sync: Sync is turned off in the cloud.');
6868
this.logService.info('Auto Sync: Resetting the local sync state.');
6969
await this.userDataSyncService.resetLocal();
7070
this.logService.info('Auto Sync: Completed resetting the local sync state.');
7171
if (auto) {
72-
return this.userDataSyncEnablementService.setEnablement(false);
72+
this.userDataSyncEnablementService.setEnablement(false);
73+
this._onError.fire(error);
74+
return;
7375
} else {
7476
return this.sync(loop, auto);
7577
}
7678
}
77-
if (error.code === UserDataSyncErrorCode.SessionExpired) {
78-
this.logService.info('Auto Sync: Cloud has new session');
79-
this.logService.info('Auto Sync: Resetting the local sync state.');
80-
await this.userDataSyncService.resetLocal();
81-
this.logService.info('Auto Sync: Completed resetting the local sync state.');
82-
return this.sync(loop, auto);
83-
}
8479
this.logService.error(error);
8580
this.successiveFailures++;
8681
this._onError.fire(error);

src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,12 +373,22 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
373373

374374
private onAutoSyncError(error: UserDataSyncError): void {
375375
switch (error.code) {
376+
case UserDataSyncErrorCode.TurnedOff:
377+
case UserDataSyncErrorCode.SessionExpired:
378+
this.notificationService.notify({
379+
severity: Severity.Info,
380+
message: localize('turned off', "Turned off sync because it was turned off from other device."),
381+
actions: {
382+
primary: [new Action('turn on sync', localize('Turn on sync', "Turn on Sync"), undefined, true, () => this.turnOn())]
383+
}
384+
});
385+
return;
376386
case UserDataSyncErrorCode.TooLarge:
377387
if (error.source === SyncSource.Keybindings || error.source === SyncSource.Settings) {
378388
const sourceArea = getSyncAreaLabel(error.source);
379389
this.notificationService.notify({
380390
severity: Severity.Error,
381-
message: localize('too large', "Disabled synchronizing {0} because size of the {1} file to sync is larger than {2}. Please open the file and reduce the size and enable sync", sourceArea, sourceArea, '100kb'),
391+
message: localize('too large', "Disabled sync {0} because size of the {1} file to sync is larger than {2}. Please open the file and reduce the size and enable sync", sourceArea, sourceArea, '100kb'),
382392
actions: {
383393
primary: [new Action('open sync file', localize('open file', "Show {0} file", sourceArea), undefined, true,
384394
() => error.source === SyncSource.Settings ? this.preferencesService.openGlobalSettings(true) : this.preferencesService.openGlobalKeybindingSettings(true))]
@@ -390,7 +400,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
390400
this.disableSync();
391401
this.notificationService.notify({
392402
severity: Severity.Error,
393-
message: localize('error incompatible', "Turned off synchronizing because local data is incompatible with the data in the cloud. Please update {0} and turn on sync to continue syncing.", this.productService.nameLong),
403+
message: localize('error incompatible', "Turned off sync because local data is incompatible with the data in the cloud. Please update {0} and turn on sync to continue syncing.", this.productService.nameLong),
394404
});
395405
return;
396406
}

0 commit comments

Comments
 (0)