diff --git a/packages/core/src/amazonqFeatureDev/client/featureDev.ts b/packages/core/src/amazonqFeatureDev/client/featureDev.ts index 01be84828b3..56c4d5ef5f4 100644 --- a/packages/core/src/amazonqFeatureDev/client/featureDev.ts +++ b/packages/core/src/amazonqFeatureDev/client/featureDev.ts @@ -10,7 +10,7 @@ import { ServiceOptions } from '../../shared/awsClientBuilder' import globals from '../../shared/extensionGlobals' import { getLogger } from '../../shared/logger' import * as FeatureDevProxyClient from './featuredevproxyclient' -import { featureName } from '../constants' +import { featureName, startTaskAssistLimitReachedMessage } from '../constants' import { CodeReference } from '../../amazonq/webview/ui/connector' import { ApiError, @@ -185,10 +185,7 @@ export class FeatureDevClient { ) 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.') - ) { + if (e.code === 'ThrottlingException' && e.message.includes(startTaskAssistLimitReachedMessage)) { throw new MonthlyConversationLimitError(e.message) } // BE service will throw ServiceQuota if code generation iteration limit is reached diff --git a/packages/core/src/amazonqFeatureDev/constants.ts b/packages/core/src/amazonqFeatureDev/constants.ts index 5c00e8d7bfa..4bc3ca1fdb2 100644 --- a/packages/core/src/amazonqFeatureDev/constants.ts +++ b/packages/core/src/amazonqFeatureDev/constants.ts @@ -20,6 +20,12 @@ export const generateDevFilePrompt = // Max allowed size for file collection export const maxRepoSizeBytes = 200 * 1024 * 1024 +export const startCodeGenClientErrorMessages = ['Improperly formed request', 'Resource not found'] +export const startTaskAssistLimitReachedMessage = 'StartTaskAssistCodeGeneration reached for this month.' +export const clientErrorMessages = [ + 'The folder you chose did not contain any source files in a supported language. Choose another folder and try again.', +] + // License text that's used in codewhisperer reference log export const referenceLogText = (reference: CodeReference) => `[${new Date().toLocaleString()}] Accepted recommendation from Amazon Q. Code provided with reference under