Skip to content

Commit bf8700f

Browse files
committed
fix(amazonq): fix uploading file method error handling for /doc
1 parent 4421290 commit bf8700f

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "Amazon Q /doc: Fix uploading file method throwing incorrect workspace too large error message"
4+
}

packages/core/src/amazonq/util/files.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
} from '../../shared/utilities/workspaceUtils'
1414

1515
import { ContentLengthError, PrepareRepoFailedError } from '../../amazonqFeatureDev/errors'
16+
import { ContentLengthError as DocContentLengthError } from '../../amazonqDoc/errors'
1617
import { getLogger } from '../../shared/logger/logger'
1718
import { maxFileSizeBytes } from '../../amazonqFeatureDev/limits'
1819
import { CurrentWsFolders, DeletedFileInfo, NewFileInfo, NewFileZipContents } from '../../amazonqDoc/types'
@@ -48,6 +49,7 @@ export type PrepareRepoDataOptions = {
4849
telemetry?: TelemetryHelper
4950
zip?: ZipStream
5051
isIncludeInfraDiagram?: boolean
52+
featureName?: 'featureDev' | 'docGeneration'
5153
}
5254

5355
/**
@@ -186,6 +188,9 @@ export async function prepareRepoData(
186188
} catch (error) {
187189
getLogger().debug(`featureDev: Failed to prepare repo: ${error}`)
188190
if (error instanceof ToolkitError && error.code === 'ContentLengthError') {
191+
if (options?.featureName === 'docGeneration') {
192+
throw new DocContentLengthError()
193+
}
189194
throw new ContentLengthError()
190195
}
191196
throw new PrepareRepoFailedError()

packages/core/src/amazonqDoc/session/sessionState.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ export class DocPrepareCodeGenState extends BasePrepareCodeGenState {
144144
return await prepareRepoData(workspaceRoots, workspaceFolders, span, {
145145
...options,
146146
isIncludeInfraDiagram: true,
147+
featureName: 'docGeneration',
147148
})
148149
}
149150
}

0 commit comments

Comments
 (0)