diff --git a/packages/amazonq/.changes/next-release/Feature-8a43c3c3-9ecb-44b6-bb0c-34d2065aee26.json b/packages/amazonq/.changes/next-release/Feature-8a43c3c3-9ecb-44b6-bb0c-34d2065aee26.json new file mode 100644 index 00000000000..7e1d6e86caa --- /dev/null +++ b/packages/amazonq/.changes/next-release/Feature-8a43c3c3-9ecb-44b6-bb0c-34d2065aee26.json @@ -0,0 +1,4 @@ +{ + "type": "Feature", + "description": "feat(amazonq): Add error message for updated README too large" +} diff --git a/packages/core/package.nls.json b/packages/core/package.nls.json index 024a2a3cc9f..d0e31cbcb33 100644 --- a/packages/core/package.nls.json +++ b/packages/core/package.nls.json @@ -379,6 +379,7 @@ "AWS.amazonq.doc.error.noFolderSelected": "It looks like you didn't choose a folder. Choose a folder to continue.", "AWS.amazonq.doc.error.contentLengthError": "Your workspace is too large for me to review. Your workspace must be within the quota, even if you choose a smaller folder. For more information on quotas, see the Amazon Q Developer documentation.", "AWS.amazonq.doc.error.readmeTooLarge": "The README in your folder is too large for me to review. Try reducing the size of your README, or choose a folder with a smaller README. For more information on quotas, see the Amazon Q Developer documentation.", + "AWS.amazonq.doc.error.readmeUpdateTooLarge": "The updated README is too large. Try reducing the size of your README, or asking for a smaller update. For more information on quotas, see the Amazon Q Developer documentation.", "AWS.amazonq.doc.error.workspaceEmpty": "The folder you chose did not contain any source files in a supported language. Choose another folder and try again. For more information on supported languages, see the Amazon Q Developer documentation.", "AWS.amazonq.doc.error.promptTooVague": "I need more information to make changes to your README. Try providing some of the following details:\n- Which sections you want to modify\n- The content you want to add or remove\n- Specific issues that need correcting\n\nFor more information on prompt best practices, see the Amazon Q Developer documentation.", "AWS.amazonq.doc.error.promptUnrelated": "These changes don't seem related to documentation. Try describing your changes again, using the following best practices:\n- Changes should relate to how project functionality is reflected in the README\n- Content you refer to should be available in your codebase\n\n For more information on prompt best practices, see the Amazon Q Developer documentation.", diff --git a/packages/core/src/amazonqDoc/errors.ts b/packages/core/src/amazonqDoc/errors.ts index fb918ec7c53..d9794f16327 100644 --- a/packages/core/src/amazonqDoc/errors.ts +++ b/packages/core/src/amazonqDoc/errors.ts @@ -20,6 +20,14 @@ export class ReadmeTooLargeError extends ToolkitError { } } +export class ReadmeUpdateTooLargeError extends ToolkitError { + constructor() { + super(i18n('AWS.amazonq.doc.error.readmeUpdateTooLarge'), { + code: ReadmeUpdateTooLargeError.name, + }) + } +} + export class WorkspaceEmptyError extends ToolkitError { constructor() { super(i18n('AWS.amazonq.doc.error.workspaceEmpty'), { diff --git a/packages/core/src/amazonqDoc/session/sessionState.ts b/packages/core/src/amazonqDoc/session/sessionState.ts index 03e234a9429..b3404c7998a 100644 --- a/packages/core/src/amazonqDoc/session/sessionState.ts +++ b/packages/core/src/amazonqDoc/session/sessionState.ts @@ -45,6 +45,7 @@ import { PromptTooVagueError, PromptUnrelatedError, ReadmeTooLargeError, + ReadmeUpdateTooLargeError, WorkspaceEmptyError, } from '../errors' import { DocMessenger } from '../messenger' @@ -149,6 +150,9 @@ abstract class CodeGenBase { case codegenResult.codeGenerationStatusDetail?.includes('README_TOO_LARGE'): { throw new ReadmeTooLargeError() } + case codegenResult.codeGenerationStatusDetail?.includes('README_UPDATE_TOO_LARGE'): { + throw new ReadmeUpdateTooLargeError() + } case codegenResult.codeGenerationStatusDetail?.includes('WORKSPACE_TOO_LARGE'): { throw new ContentLengthError() }