Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions packages/core/src/codewhisperer/region/regionProfileManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,17 @@ export class RegionProfileManager {
}
}

// Only throw error if all regions fail
if (failedRegions.length === endpoints.size) {
throw new Error(`Failed to list profiles for all regions: ${failedRegions.join(', ')}`)
// Throw error if any regional API calls failed and no profiles are available
if (failedRegions.length > 0 && availableProfiles.length === 0) {
throw new ToolkitError(`Failed to list Q Developer profiles for regions: ${failedRegions.join(', ')}`, {
code: 'ListQDeveloperProfilesFailed',
})
}

// Throw an error if all listAvailableProfile calls succeeded, but user has no Q developer profiles
// This is not an expected state
if (failedRegions.length === 0 && availableProfiles.length === 0) {
throw new ToolkitError('This user has no Q Developer profiles', { code: 'QDeveloperProfileNotFound' })
}

this._profiles = availableProfiles
Expand Down
Loading