Skip to content

Commit 55cb4eb

Browse files
committed
chore(textract): drop redundant inline comments
1 parent dd92247 commit 55cb4eb

3 files changed

Lines changed: 1 addition & 7 deletions

File tree

apps/sim/app/api/tools/textract/shared.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ describe('pollTextractJob', () => {
139139
NextToken: 'next',
140140
}
141141
}
142-
// Follow-up pages from AWS often omit DocumentMetadata/model-version fields.
143142
return { JobStatus: 'SUCCEEDED', Blocks: [{ Id: '2' }] }
144143
},
145144
(accumulated, page) => ({

apps/sim/app/api/tools/textract/shared.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ export function mapTextractSdkError(
7575
return new TextractRouteError(`This document format is not supported.${hint}`, 400)
7676
}
7777

78-
// No status at all (e.g. a network failure before AWS responded) is a server-side problem, not a
79-
// bad request — default to 500 so tool-execution retry logic still treats it as retryable.
8078
const status = err.$metadata?.httpStatusCode ?? 500
8179
return new TextractRouteError(err.message || 'Textract API error', status)
8280
}
@@ -91,6 +89,7 @@ export type ResolveDocumentResult =
9189
| { ok: true; document: ResolvedDocument }
9290
| { ok: false; response: NextResponse }
9391

92+
/** Passes through the document host's real HTTP status on failure, so tool-execution retry logic can still treat a transient 5xx as retryable. */
9493
async function fetchDocumentBytes(url: string): Promise<{ bytes: Buffer; contentType: string }> {
9594
const urlValidation = await validateUrlWithDNS(url, 'Document URL')
9695
if (!urlValidation.isValid) {
@@ -102,8 +101,6 @@ async function fetchDocumentBytes(url: string): Promise<{ bytes: Buffer; content
102101
})
103102
if (!response.ok) {
104103
await response.text().catch(() => {})
105-
// Pass through the document host's real status (e.g. a transient 503) instead of a
106-
// hardcoded 400, so tool-execution retry logic can still treat 5xx as retryable.
107104
throw new TextractRouteError(
108105
`Failed to fetch document: ${response.statusText}`,
109106
response.status

apps/sim/blocks/blocks/textract.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,12 +407,10 @@ export const TextractV2Block: BlockConfig<TextractParserOutput> = {
407407
}
408408
parameters.s3Uri = params.s3Uri.trim()
409409
} else if (operation === 'analyze_expense') {
410-
// textract_analyze_expense accepts filePath as a fallback for URL-based documents.
411410
const resolved = resolveDocumentParam(params.document)
412411
if (!resolved.file && !resolved.filePath) throw new Error('Document file is required')
413412
Object.assign(parameters, resolved)
414413
} else {
415-
// textract_parser_v2 (analyze_document) has no filePath param — file only.
416414
const file = normalizeFileInput(params.document, { single: true })
417415
if (!file) throw new Error('Document file is required')
418416
parameters.file = file

0 commit comments

Comments
 (0)