mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-15 17:22:25 -05:00
error handling for browse azure resources (#15291)
* custom error for throttling * remove unused imports
This commit is contained in:
@@ -16,7 +16,6 @@ import { TreeNode } from '../treeNode';
|
||||
import { AzureResourceCredentialError } from '../errors';
|
||||
import { AzureResourceContainerTreeNodeBase } from './baseTreeNodes';
|
||||
import { AzureResourceItemType, AzureResourceServiceNames } from '../constants';
|
||||
import { AzureResourceMessageTreeNode } from '../messageTreeNode';
|
||||
import { IAzureResourceTreeChangeHandler } from './treeChangeHandler';
|
||||
import { IAzureResourceSubscriptionService, IAzureResourceSubscriptionFilterService } from '../../azureResource/interfaces';
|
||||
import { AzureAccount } from 'azurecore';
|
||||
@@ -223,7 +222,10 @@ class FlatAccountTreeNodeLoader {
|
||||
if (error instanceof AzureResourceCredentialError) {
|
||||
vscode.commands.executeCommand('azure.resource.signin');
|
||||
}
|
||||
this._nodes = [AzureResourceMessageTreeNode.create(AzureResourceErrorMessageUtil.getErrorMessage(error), this._accountNode)];
|
||||
// http status code 429 means "too many requests"
|
||||
// use a custom error message for azure resource graph api throttling error to make it more actionable for users.
|
||||
const errorMessage = error?.statusCode === 429 ? localize('azure.resource.throttleerror', "Requests from this account have been throttled. To retry, please select a smaller number of subscriptions.") : AzureResourceErrorMessageUtil.getErrorMessage(error);
|
||||
vscode.window.showErrorMessage(localize('azure.resource.tree.loadresourceerror', "An error occured while loading Azure resources: {0}", errorMessage));
|
||||
}
|
||||
|
||||
this._isLoading = false;
|
||||
|
||||
Reference in New Issue
Block a user