Skip to content

Commit 815f7a9

Browse files
Merge master into feature/emr
2 parents 4eb9c45 + 040b10b commit 815f7a9

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

packages/core/src/codewhisperer/region/regionProfileManager.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,17 @@ export class RegionProfileManager {
177177
}
178178
}
179179

180-
// Only throw error if all regions fail
181-
if (failedRegions.length === endpoints.size) {
182-
throw new Error(`Failed to list profiles for all regions: ${failedRegions.join(', ')}`)
180+
// Throw error if any regional API calls failed and no profiles are available
181+
if (failedRegions.length > 0 && availableProfiles.length === 0) {
182+
throw new ToolkitError(`Failed to list Q Developer profiles for regions: ${failedRegions.join(', ')}`, {
183+
code: 'ListQDeveloperProfilesFailed',
184+
})
185+
}
186+
187+
// Throw an error if all listAvailableProfile calls succeeded, but user has no Q developer profiles
188+
// This is not an expected state
189+
if (failedRegions.length === 0 && availableProfiles.length === 0) {
190+
throw new ToolkitError('This user has no Q Developer profiles', { code: 'QDeveloperProfileNotFound' })
183191
}
184192

185193
this._profiles = availableProfiles

0 commit comments

Comments
 (0)