src/vs/platform/userDataSync/common/userDataSyncService.ts/UserDataSyncService/sync
class UserDataSyncService:	private async sync(manifest: IUserDataManifest | null, executionId: string, token: CancellationToken): Promise<void> {
		if (!this.recoveredSettings) {
			await this.settingsSynchroniser.recoverSettings();
			this.recoveredSettings = true;
		}

		// Return if cancellation is requested
		if (token.isCancellationRequested) {
			return;
		}

		const startTime = new Date().getTime();
		this._syncErrors = [];
		try {
			this.logService.trace('Sync started.');
			if (this.status !== SyncStatus.HasConflicts) {
				this.setStatus(SyncStatus.Syncing);
			}

			const syncHeaders = createSyncHeaders(executionId);

			for (const synchroniser of this.synchronisers) {
				// Return if cancellation is requested
				if (token.isCancellationRequested) {
					return;
				}
				try {
					await synchroniser.sync(manifest, syncHeaders);
				} catch (e) {

					if (e instanceof UserDataSyncError) {
						// Bail out for following errors
						switch (e.code) {
							case UserDataSyncErrorCode.TooLarge:
								throw new UserDataSyncError(e.message, e.code, synchroniser.resource);
							case UserDataSyncErrorCode.TooManyRequests:
							case UserDataSyncErrorCode.TooManyRequestsAndRetryAfter:
							case UserDataSyncErrorCode.LocalTooManyRequests:
							case UserDataSyncErrorCode.Gone:
							case UserDataSyncErrorCode.UpgradeRequired:
							case UserDataSyncErrorCode.IncompatibleRemoteContent:
							case UserDataSyncErrorCode.IncompatibleLocalContent:
								throw e;
						}
					}

					// Log and report other errors and continue
					const userDataSyncError = UserDataSyncError.toUserDataSyncError(e);
					this.reportUserDataSyncError(userDataSyncError, executionId);
					this.logService.error(e);
					this.logService.error(`${synchroniser.resource}: ${toErrorMessage(e)}`);
					this._syncErrors.push([synchroniser.resource, userDataSyncError]);
				}
			}

			this.logService.info(`Sync done. Took ${new Date().getTime() - startTime}ms`);
			this.updateLastSyncTime();
		} catch (error) {
			const userDataSyncError = UserDataSyncError.toUserDataSyncError(error);
			this.reportUserDataSyncError(userDataSyncError, executionId);
			throw userDataSyncError;
		} finally {
			this.updateStatus();
			this._onSyncErrors.fire(this._syncErrors);
		}
	}