diff --git a/src/tree/azure/grouping/GroupingItem.ts b/src/tree/azure/grouping/GroupingItem.ts index aff664a7..c48fc62e 100644 --- a/src/tree/azure/grouping/GroupingItem.ts +++ b/src/tree/azure/grouping/GroupingItem.ts @@ -3,11 +3,12 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { createContextValue, ISubscriptionContext, TreeItemIconPath } from '@microsoft/vscode-azext-utils'; +import { createContextValue, ISubscriptionContext, parseError, TreeItemIconPath } from '@microsoft/vscode-azext-utils'; import * as vscode from 'vscode'; import { AzExtResourceType, AzureResource, AzureResourceBranchDataProvider, AzureResourceModel, AzureSubscription } from '../../../../api/src/index'; import { ext } from '../../../extensionVariables'; import { getIconPath } from '../../../utils/azureUtils'; +import { localize } from '../../../utils/localize'; import { createPortalUrl } from '../../../utils/v2/createPortalUrl'; import { BranchDataItemOptions } from '../../BranchDataItemWrapper'; import { GenericItem } from '../../GenericItem'; @@ -104,7 +105,7 @@ export class GroupingItem implements ResourceGroupsItem { items.push(new GenericItem('', { description: subscription.name })); } - for await (const resource of subscriptionGroupingMap.get(subscription) ?? []) { + await Promise.allSettled((subscriptionGroupingMap.get(subscription) ?? []).map(async (resource): Promise => { try { const branchDataProvider = this.branchDataProviderFactory(resource); const resourceItem = await branchDataProvider.getResourceItem(resource); @@ -123,10 +124,14 @@ export class GroupingItem implements ResourceGroupsItem { items.push(this.resourceItemFactory(resource, resourceItem, branchDataProvider, this, options)); } catch (e) { + const parsedError = parseError(e); + ext.outputChannel.appendLog(localize('errorResolving', 'Error resolving resource item for {0}: {1}', resource.id, parsedError.message)); items.push(new InvalidAzureResourceItem(resource, e)); + throw parsedError; } - } - return items; + })); + + return items.sort((a, b) => (a.id.split('/').pop() ?? '').localeCompare((b.id.split('/').pop() ?? ''))); })); // flatten resourceItems