提交 2e66ecb8 编写于 作者: S Sandeep Somavarapu

Fix #89750

上级 9fab9da7
......@@ -63,24 +63,19 @@ export class UserDataAutoSyncService extends Disposable implements IUserDataAuto
this.resetFailures();
} catch (e) {
const error = UserDataSyncError.toUserDataSyncError(e);
if (error.code === UserDataSyncErrorCode.TurnedOff) {
if (error.code === UserDataSyncErrorCode.TurnedOff || error.code === UserDataSyncErrorCode.SessionExpired) {
this.logService.info('Auto Sync: Sync is turned off in the cloud.');
this.logService.info('Auto Sync: Resetting the local sync state.');
await this.userDataSyncService.resetLocal();
this.logService.info('Auto Sync: Completed resetting the local sync state.');
if (auto) {
return this.userDataSyncEnablementService.setEnablement(false);
this.userDataSyncEnablementService.setEnablement(false);
this._onError.fire(error);
return;
} else {
return this.sync(loop, auto);
}
}
if (error.code === UserDataSyncErrorCode.SessionExpired) {
this.logService.info('Auto Sync: Cloud has new session');
this.logService.info('Auto Sync: Resetting the local sync state.');
await this.userDataSyncService.resetLocal();
this.logService.info('Auto Sync: Completed resetting the local sync state.');
return this.sync(loop, auto);
}
this.logService.error(error);
this.successiveFailures++;
this._onError.fire(error);
......
......@@ -373,12 +373,22 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
private onAutoSyncError(error: UserDataSyncError): void {
switch (error.code) {
case UserDataSyncErrorCode.TurnedOff:
case UserDataSyncErrorCode.SessionExpired:
this.notificationService.notify({
severity: Severity.Info,
message: localize('turned off', "Turned off sync because it was turned off from other device."),
actions: {
primary: [new Action('turn on sync', localize('Turn on sync', "Turn on Sync"), undefined, true, () => this.turnOn())]
}
});
return;
case UserDataSyncErrorCode.TooLarge:
if (error.source === SyncSource.Keybindings || error.source === SyncSource.Settings) {
const sourceArea = getSyncAreaLabel(error.source);
this.notificationService.notify({
severity: Severity.Error,
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'),
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'),
actions: {
primary: [new Action('open sync file', localize('open file', "Show {0} file", sourceArea), undefined, true,
() => error.source === SyncSource.Settings ? this.preferencesService.openGlobalSettings(true) : this.preferencesService.openGlobalKeybindingSettings(true))]
......@@ -390,7 +400,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
this.disableSync();
this.notificationService.notify({
severity: Severity.Error,
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),
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),
});
return;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册