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
30 changes: 21 additions & 9 deletions packages/core/src/amazonqFeatureDev/client/featureDev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ export class FeatureDevClient {
getLogger().error(
`${featureName}: failed to start conversation: ${e.message} RequestId: ${e.requestId}`
)
if (e.code === 'ServiceQuotaExceededException') {
// BE service will throw ServiceQuota if conversation limit is reached. API Front-end will throw Throttling with this message if conversation limit is reached
if (
e.code === 'ServiceQuotaExceededException' ||
(e.code === 'ThrottlingException' && e.message.includes('reached for this month.'))
) {
throw new MonthlyConversationLimitError(e.message)
}
throw new ApiError(e.message, 'CreateConversation', e.code, e.statusCode ?? 400)
Expand Down Expand Up @@ -167,14 +171,22 @@ export class FeatureDevClient {
(e as any).requestId
}`
)
if (
isAwsError(e) &&
((e.code === 'ThrottlingException' &&
e.message.includes('limit for number of iterations on a code generation')) ||
e.message.includes('StartTaskAssistCodeGeneration reached for this month.') ||
e.code === 'ServiceQuotaExceededException')
) {
throw new CodeIterationLimitError()
if (isAwsError(e)) {
// API Front-end will throw Throttling if conversation limit is reached. API Front-end monitors StartCodeGeneration for throttling
if (
e.code === 'ThrottlingException' &&
e.message.includes('StartTaskAssistCodeGeneration reached for this month.')
) {
throw new MonthlyConversationLimitError(e.message)
}
// BE service will throw ServiceQuota if code generation iteration limit is reached
else if (
e.code === 'ServiceQuotaExceededException' ||
(e.code === 'ThrottlingException' &&
e.message.includes('limit for number of iterations on a code generation'))
) {
throw new CodeIterationLimitError()
}
}
throw new ToolkitError((e as Error).message, { code: 'StartCodeGenerationFailed' })
}
Expand Down
Loading