Skip to content

Commit a990210

Browse files
fix: [Amazon Q] handle exceptions in service request (#4140)
Currently, most exceptions that occur when the amazon Q API is invoked are suppressed and are not surfaced to the user (For ex, `AccessDeniedException`). The plugin proceeds like the call succeeded, and subsequently makes another call to add a telemetry event that also fails due to an improperly formed request (from not having a conversationId), and the user is shown this error instead of the original error. This change fixed that.
1 parent 575cfae commit a990210

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type" : "bugfix",
3+
"description" : "Amazon Q: Service exceptions are not suppressed and displayed to the user."
4+
}

jetbrains-core/src/software/aws/toolkits/jetbrains/services/cwc/controller/chat/messenger/ChatPromptHandler.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ class ChatPromptHandler(private val telemetryHelper: TelemetryHelper) {
5252
// Don't emit any other responses if we cancelled the collection
5353
if (error is CancellationException) {
5454
return@onCompletion
55+
} // for any other exception, let the `catch` operator handle it.
56+
else if (error != null) {
57+
throw error
5558
}
5659

5760
// Send the gathered suggestions in a final answer-part message

0 commit comments

Comments
 (0)