diff options
author | Sandeep Somavarapu <sasomava@microsoft.com> | 2020-08-25 12:40:01 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-25 12:40:01 +0300 |
commit | a0479759d6e9ea56afa657e454193f72aef85bd0 (patch) | |
tree | 5661e35a92b5725b775a66f00cdbdb279735f9ea | |
parent | d735393c6600c68f4c986a44b527c28a459b6511 (diff) | |
parent | e6e146b0754a33202e46ed039b1cd501276074bf (diff) |
Merge pull request #105341 from microsoft/sandy081/fix1048341.48.2release/1.48
Fix #104834
3 files changed, 6 insertions, 0 deletions
diff --git a/src/vs/platform/userDataSync/common/abstractSynchronizer.ts b/src/vs/platform/userDataSync/common/abstractSynchronizer.ts index 3457eabe31e..8c2a45ad2cc 100644 --- a/src/vs/platform/userDataSync/common/abstractSynchronizer.ts +++ b/src/vs/platform/userDataSync/common/abstractSynchronizer.ts @@ -324,6 +324,7 @@ export abstract class AbstractSynchroniser extends Disposable { this.logService.info(`${this.syncResourceLogLabel}: Failed to synchronize ${this.syncResourceLogLabel} as there is a new local version available. Synchronizing again...`); return this.performSync(remoteUserData, lastSyncUserData, apply); + case UserDataSyncErrorCode.Conflict: case UserDataSyncErrorCode.PreconditionFailed: // Rejected as there is a new remote version. Syncing again... this.logService.info(`${this.syncResourceLogLabel}: Failed to synchronize as there is a new remote version available. Synchronizing again...`); diff --git a/src/vs/platform/userDataSync/common/userDataSync.ts b/src/vs/platform/userDataSync/common/userDataSync.ts index dbc24ef949e..28d97316a66 100644 --- a/src/vs/platform/userDataSync/common/userDataSync.ts +++ b/src/vs/platform/userDataSync/common/userDataSync.ts @@ -208,6 +208,7 @@ export const HEADER_EXECUTION_ID = 'X-Execution-Id'; export enum UserDataSyncErrorCode { // Client Errors (>= 400 ) Unauthorized = 'Unauthorized', /* 401 */ + Conflict = 'Conflict', /* 409 */ Gone = 'Gone', /* 410 */ PreconditionFailed = 'PreconditionFailed', /* 412 */ TooLarge = 'TooLarge', /* 413 */ diff --git a/src/vs/platform/userDataSync/common/userDataSyncStoreService.ts b/src/vs/platform/userDataSync/common/userDataSyncStoreService.ts index d17ec3b39fc..be9858f31de 100644 --- a/src/vs/platform/userDataSync/common/userDataSyncStoreService.ts +++ b/src/vs/platform/userDataSync/common/userDataSyncStoreService.ts @@ -395,6 +395,10 @@ export class UserDataSyncStoreService extends Disposable implements IUserDataSyn this._onTokenSucceed.fire(); + if (context.res.statusCode === 409) { + throw new UserDataSyncStoreError(`${options.type} request '${options.url?.toString()}' failed because of Conflict (409). There is new data exists for this resource. Make the request again with latest data.`, UserDataSyncErrorCode.Conflict, operationId); + } + if (context.res.statusCode === 410) { throw new UserDataSyncStoreError(`${options.type} request '${options.url?.toString()}' failed because the requested resource is not longer available (410).`, UserDataSyncErrorCode.Gone, operationId); } |