Skip to content

Commit a047975

Browse files
authored
Merge pull request #105341 from microsoft/sandy081/fix104834
Fix #104834
2 parents d735393 + e6e146b commit a047975

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ export abstract class AbstractSynchroniser extends Disposable {
324324
this.logService.info(`${this.syncResourceLogLabel}: Failed to synchronize ${this.syncResourceLogLabel} as there is a new local version available. Synchronizing again...`);
325325
return this.performSync(remoteUserData, lastSyncUserData, apply);
326326

327+
case UserDataSyncErrorCode.Conflict:
327328
case UserDataSyncErrorCode.PreconditionFailed:
328329
// Rejected as there is a new remote version. Syncing again...
329330
this.logService.info(`${this.syncResourceLogLabel}: Failed to synchronize as there is a new remote version available. Synchronizing again...`);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ export const HEADER_EXECUTION_ID = 'X-Execution-Id';
208208
export enum UserDataSyncErrorCode {
209209
// Client Errors (>= 400 )
210210
Unauthorized = 'Unauthorized', /* 401 */
211+
Conflict = 'Conflict', /* 409 */
211212
Gone = 'Gone', /* 410 */
212213
PreconditionFailed = 'PreconditionFailed', /* 412 */
213214
TooLarge = 'TooLarge', /* 413 */

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,10 @@ export class UserDataSyncStoreService extends Disposable implements IUserDataSyn
395395

396396
this._onTokenSucceed.fire();
397397

398+
if (context.res.statusCode === 409) {
399+
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);
400+
}
401+
398402
if (context.res.statusCode === 410) {
399403
throw new UserDataSyncStoreError(`${options.type} request '${options.url?.toString()}' failed because the requested resource is not longer available (410).`, UserDataSyncErrorCode.Gone, operationId);
400404
}

0 commit comments

Comments
 (0)