-
Notifications
You must be signed in to change notification settings - Fork 251
fix(amazonq): cancel chat export doesn't bubble error up to user #5723
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Qodana Community for JVM1 new problem were found
💡 Qodana analysis was run in the pull request mode: only the changed files were checked Contact Qodana teamContact us at qodana-support@jetbrains.com
|
...s-community/src/software/aws/toolkits/jetbrains/services/amazonq/webview/BrowserConnector.kt
Show resolved
Hide resolved
...s-community/src/software/aws/toolkits/jetbrains/services/amazonq/webview/BrowserConnector.kt
Outdated
Show resolved
Hide resolved
@@ -230,8 +233,7 @@ class AmazonQLanguageClientImpl(private val project: Project) : AmazonQLanguageC | |||
|
|||
chosenFile?.let { | |||
ShowSaveFileDialogResult(chosenFile.file.path) | |||
// TODO: Add error state shown in chat ui instead of throwing | |||
} ?: throw Error("Export failed") | |||
} ?: throw ResponseErrorException(ResponseError(ResponseErrorCode.RequestCancelled, "Export cancelled by user", null)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to throw this here to get the specific RequestCancelled
error otherwise the ResponseErrorCode is InternalError
which I think is a little too generic and I'm afraid it may unintentionally catch things. Is there any other reason the chosenFile would be null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like they either choose a file or they dont
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other error condition that I can think of here is if a file is chosen which is not html or md if it exists but with the filtering dont think a user should run into this
…kits/jetbrains/services/amazonq/webview/BrowserConnector.kt Co-authored-by: Richard Li <742829+rli@users.noreply.github.com>
…kits/jetbrains/services/amazonq/webview/BrowserConnector.kt Co-authored-by: Richard Li <742829+rli@users.noreply.github.com>
val cause = if (e is CompletionException) e.cause else e | ||
|
||
// dont post error to UI if user cancels export | ||
if (cause is ResponseErrorException && cause.responseError.code == ResponseErrorCode.RequestCancelled.getValue()) { |
Check notice
Code scanning / QDJVMC
Accessor call that can be replaced with property access syntax Note
Clicking cancel after save popup window would bubble up an error to the user in the IDE, and also print the error to the chat UI.
This change throws the right error when a user selects cancel on the save window and filters out the error from being printed in the chat.
Types of changes
Description
Checklist
License
I confirm that my contribution is made under the terms of the Apache 2.0 license.