Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@
} catch (_: CancellationException) {
LOG.warn { "Cancelled chat generation" }
} catch (e: Exception) {
LOG.error(e) { "Failed to send chat message" }
LOG.warn(e) { "Failed to send chat message" }

Check warning on line 482 in plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/webview/BrowserConnector.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/webview/BrowserConnector.kt#L482

Added line #L482 was not covered by tests
browser.postChat(chatCommunicationManager.getErrorUiMessage(tabId, e, partialResultToken))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
package software.aws.toolkits.jetbrains.services.amazonq.lsp.flareChat

import com.google.gson.Gson
import com.google.gson.JsonObject
import com.intellij.openapi.components.Service
import com.intellij.openapi.components.service
import com.intellij.openapi.project.Project
import kotlinx.coroutines.CompletableDeferred
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch
import org.eclipse.lsp4j.ProgressParams
import org.eclipse.lsp4j.jsonrpc.ResponseErrorException
import software.aws.toolkits.core.utils.getLogger
import software.aws.toolkits.core.utils.warn
import software.aws.toolkits.jetbrains.core.credentials.ToolkitConnectionManager
Expand Down Expand Up @@ -122,8 +124,13 @@
token?.let {
removePartialChatMessage(it)
}
var errorMessage: String? = null

Check warning on line 127 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/flareChat/ChatCommunicationManager.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/flareChat/ChatCommunicationManager.kt#L127

Added line #L127 was not covered by tests
if (exception is ResponseErrorException) {
errorMessage = (exception.responseError.data as? JsonObject)?.get("body")?.asString ?: exception.responseError.message
}

val errorTitle = "An error occurred while processing your request."
val errorMessage = "Details: ${exception.message}"
errorMessage = errorMessage ?: "Details: ${exception.message}"
val errorParams = Gson().toJson(ErrorParams(tabId, null, errorMessage, errorTitle)).toString()
val isPartialResult = false
val uiMessage = """
Expand Down
Loading