Skip to content

Commit c6c5fc2

Browse files
authored
fix(amazonq): do not overwrite failure reason, use lowercase lang name (aws#6055)
## Problem Our backend is expecting the language name (`java` or `sql`) to be lowercase, not uppercase. Also, the failure reason returned by one of our APIs was being overwritten and not shown to users. ## Solution User lowercase, and prevent overwriting.
1 parent 85a46ce commit c6c5fc2

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

packages/core/src/codewhisperer/commands/startTransformByQ.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -718,8 +718,12 @@ export async function finalizeTransformationJob(status: string) {
718718
if (!(status === 'COMPLETED' || status === 'PARTIALLY_COMPLETED')) {
719719
getLogger().error(`CodeTransformation: ${CodeWhispererConstants.failedToCompleteJobNotification}`)
720720
jobPlanProgress['transformCode'] = StepProgress.Failed
721-
transformByQState.setJobFailureErrorNotification(CodeWhispererConstants.failedToCompleteJobNotification)
722-
transformByQState.setJobFailureErrorChatMessage(CodeWhispererConstants.failedToCompleteJobChatMessage)
721+
if (!transformByQState.getJobFailureErrorNotification()) {
722+
transformByQState.setJobFailureErrorNotification(CodeWhispererConstants.failedToCompleteJobNotification)
723+
}
724+
if (!transformByQState.getJobFailureErrorChatMessage()) {
725+
transformByQState.setJobFailureErrorChatMessage(CodeWhispererConstants.failedToCompleteJobChatMessage)
726+
}
723727
throw new Error('Job was not successful nor partially successful')
724728
}
725729
transformByQState.setToSucceeded()

packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,8 +516,8 @@ export class ProposedTransformationExplorer {
516516
programmingLanguage: {
517517
languageName:
518518
transformByQState.getTransformationType() === TransformationType.LANGUAGE_UPGRADE
519-
? 'JAVA'
520-
: 'SQL',
519+
? 'java'
520+
: 'sql',
521521
},
522522
linesOfCodeChanged: metricsData.linesOfCodeChanged,
523523
charsOfCodeChanged: metricsData.charactersOfCodeChanged,

0 commit comments

Comments
 (0)