Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 30 additions & 18 deletions packages/core/src/amazonqGumby/chat/controller/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,29 +269,41 @@ export class GumbyController {
}

private async handleLanguageUpgrade(message: any) {
try {
await this.beginTransformation(message)
const validProjects = await this.validateLanguageUpgradeProjects(message)
if (validProjects.length > 0) {
this.sessionStorage.getSession().updateCandidateProjects(validProjects)
await this.messenger.sendLanguageUpgradeProjectPrompt(validProjects, message.tabID)
await telemetry.codeTransform_submitSelection.run(async () => {
telemetry.record({
codeTransformSessionId: CodeTransformTelemetryState.instance.getSessionId(),
userChoice: 'language upgrade',
})
try {
await this.beginTransformation(message)
const validProjects = await this.validateLanguageUpgradeProjects(message)
if (validProjects.length > 0) {
this.sessionStorage.getSession().updateCandidateProjects(validProjects)
await this.messenger.sendLanguageUpgradeProjectPrompt(validProjects, message.tabID)
}
} catch (err: any) {
getLogger().error(`Error handling language upgrade: ${err}`)
}
} catch (err: any) {
getLogger().error(`Error handling language upgrade: ${err}`)
}
})
}

private async handleSQLConversion(message: any) {
try {
await this.beginTransformation(message)
const validProjects = await this.validateSQLConversionProjects(message)
if (validProjects.length > 0) {
this.sessionStorage.getSession().updateCandidateProjects(validProjects)
await this.messenger.sendSelectSQLMetadataFileMessage(message.tabID)
await telemetry.codeTransform_submitSelection.run(async () => {
telemetry.record({
codeTransformSessionId: CodeTransformTelemetryState.instance.getSessionId(),
userChoice: 'sql conversion',
})
try {
await this.beginTransformation(message)
const validProjects = await this.validateSQLConversionProjects(message)
if (validProjects.length > 0) {
this.sessionStorage.getSession().updateCandidateProjects(validProjects)
await this.messenger.sendSelectSQLMetadataFileMessage(message.tabID)
}
} catch (err: any) {
getLogger().error(`Error handling SQL conversion: ${err}`)
Copy link
Contributor

@justinmk3 justinmk3 Dec 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: if the exception is caught then run() won't reflect a result=Failed.

If handleSQLConversion is called from a command or webview, the extension global handler will log the error and show a useful message to the user. If not, then the next best approach is to let the exception through, but add .catch(...) to the run() call.

Same for the other case in this PR.

}
} catch (err: any) {
getLogger().error(`Error handling SQL conversion: ${err}`)
}
})
}

private async validateLanguageUpgradeProjects(message: any) {
Expand Down
Loading