thrownewUserDataSyncStoreError(`Request '${options.url?.toString()}' failed because of Unauthorized (401).`,UserDataSyncErrorCode.Unauthorized);
thrownewUserDataSyncStoreError(`Request '${options.url?.toString()}' failed because of Unauthorized (401).`,UserDataSyncErrorCode.Unauthorized,operationId);
}
this._onTokenSucceed.fire();
if(context.res.statusCode===410){
thrownewUserDataSyncStoreError(`${options.type} request '${options.url?.toString()}' failed because the requested resource is not longer available (410).`,UserDataSyncErrorCode.Gone);
thrownewUserDataSyncStoreError(`${options.type} request '${options.url?.toString()}' failed because the requested resource is not longer available (410).`,UserDataSyncErrorCode.Gone,operationId);
}
if(context.res.statusCode===412){
thrownewUserDataSyncStoreError(`${options.type} request '${options.url?.toString()}' failed because of Precondition Failed (412). There is new data exists for this resource. Make the request again with latest data.`,UserDataSyncErrorCode.PreconditionFailed);
thrownewUserDataSyncStoreError(`${options.type} request '${options.url?.toString()}' failed because of Precondition Failed (412). There is new data exists for this resource. Make the request again with latest data.`,UserDataSyncErrorCode.PreconditionFailed,operationId);
}
if(context.res.statusCode===413){
thrownewUserDataSyncStoreError(`${options.type} request '${options.url?.toString()}' failed because of too large payload (413).`,UserDataSyncErrorCode.TooLarge);
thrownewUserDataSyncStoreError(`${options.type} request '${options.url?.toString()}' failed because of too large payload (413).`,UserDataSyncErrorCode.TooLarge,operationId);
}
if(context.res.statusCode===426){
thrownewUserDataSyncStoreError(`${options.type} request '${options.url?.toString()}' failed with status Upgrade Required (426). Please upgrade the client and try again.`,UserDataSyncErrorCode.UpgradeRequired);
thrownewUserDataSyncStoreError(`${options.type} request '${options.url?.toString()}' failed with status Upgrade Required (426). Please upgrade the client and try again.`,UserDataSyncErrorCode.UpgradeRequired,operationId);
}
if(context.res.statusCode===429){
thrownewUserDataSyncStoreError(`${options.type} request '${options.url?.toString()}' failed because of too many requests (429).`,UserDataSyncErrorCode.TooManyRequests);
thrownewUserDataSyncStoreError(`${options.type} request '${options.url?.toString()}' failed because of too many requests (429).`,UserDataSyncErrorCode.TooManyRequests,operationId);
@@ -329,12 +338,13 @@ export class RequestsSession {
this.reset();
}
if(this.count>=this.limit){
thrownewUserDataSyncStoreError(`Too many requests. Allowed only ${this.limit} requests in ${this.interval/(1000*60)} minutes.`,UserDataSyncErrorCode.LocalTooManyRequests);
if(this.requests.length>=this.limit){
this.logService.info('Too many requests',...this.requests);
thrownewUserDataSyncStoreError(`Too many requests. Allowed only ${this.limit} requests in ${this.interval/(1000*60)} minutes.`,UserDataSyncErrorCode.LocalTooManyRequests,undefined);
}
this.startTime=this.startTime||newDate();
this.count++;
this.requests.push(options.url!);
returnthis.requestService.request(options,token);
}
...
...
@@ -344,7 +354,7 @@ export class RequestsSession {
this.handleTooLargeError(error.resource,localize('too large',"Disabled syncing {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.toLowerCase(),sourceArea.toLowerCase(),'100kb'));
this.handleTooLargeError(error.resource,localize('too large',"Disabled syncing {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.toLowerCase(),sourceArea.toLowerCase(),'100kb'),error);
}
break;
caseUserDataSyncErrorCode.Incompatible:
caseUserDataSyncErrorCode.Gone:
caseUserDataSyncErrorCode.UpgradeRequired:
this.userDataSyncWorkbenchService.turnoff(false);
constmessage=localize('error upgrade required',"Preferences sync is disabled because the current version ({0}, {1}) is not compatible with the sync service. Please update before turning on sync.",this.productService.version,this.productService.commit);
message:localize('error upgrade required',"Preferences sync is disabled because the current version ({0}, {1}) is not compatible with the sync service. Please update before turning on sync.",this.productService.version,this.productService.commit),
this.handleTooLargeError(e.resource,localize('too large while starting sync',"Preferences sync cannot be turned on because size of the {0} file to sync is larger than {1}. Please open the file and reduce the size and turn on sync",getSyncAreaLabel(e.resource).toLowerCase(),'100kb'));
this.handleTooLargeError(e.resource,localize('too large while starting sync',"Preferences sync cannot be turned on because size of the {0} file to sync is larger than {1}. Please open the file and reduce the size and turn on sync",getSyncAreaLabel(e.resource).toLowerCase(),'100kb'),e);
return;
}
break;
caseUserDataSyncErrorCode.Incompatible:
caseUserDataSyncErrorCode.Gone:
caseUserDataSyncErrorCode.UpgradeRequired:
constmessage=localize('error upgrade required while starting sync',"Preferences sync cannot be turned on because the current version ({0}, {1}) is not compatible with the sync service. Please update before turning on sync.",this.productService.version,this.productService.commit);
message:localize('error upgrade required while starting sync',"Preferences sync cannot be turned on because the current version ({0}, {1}) is not compatible with the sync service. Please update before turning on sync.",this.productService.version,this.productService.commit),
constmessage=localize({key:'too many requests',comment:['Preferences Sync is the name of the feature']},"Preferences sync is disabled because the current device is making too many requests. Please report an issue by providing the sync logs.");
this.notificationService.notify({
severity:Severity.Error,
message:localize({key:'too many requests',comment:['Preferences Sync is the name of the feature']},"Preferences sync is disabled because the current device is making too many requests. Please report an issue by providing the sync logs."),