Skip to content

Commit

Permalink
Minor edits addresing comments
Browse files Browse the repository at this point in the history
  • Loading branch information
laileni-aws committed Dec 12, 2024
1 parent 9ee9b13 commit c04de5e
Showing 1 changed file with 8 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -528,22 +528,16 @@ class CodeWhispererUTGChatManager(val project: Project, private val cs: Coroutin
launchTestGenFlow(prompt, codeTestChatHelper, previousIterationContext, selectionRange)
} catch (e: Exception) {
// Add an answer for displaying error message
var errorMessage = e.message
if (e is JsonParseException) {
errorMessage = message("testgen.error.generic_technical_error_message")
}
if (e is CodeTestException) {
errorMessage = e.uiMessage
val errorMessage = when {
e is CodeTestException && e.statusCode == "400" &&
e.message?.startsWith("CreateTestJobError: Maximum com.amazon.aws.codewhisperer.runtime.StartTestGeneration reached for this month.") == true ->
message("testgen.error.maximum_generations_reach")

e is CodeTestException -> e.uiMessage
e is JsonParseException -> message("testgen.error.generic_technical_error_message")
else -> e.message
}

if (e is CodeTestException && e.statusCode == "400" &&
e.message?.startsWith(
"CreateTestJobError: Maximum com.amazon.aws.codewhisperer.runtime.StartTestGeneration " +
"reached for this month."
) != false
) {
errorMessage = message("testgen.error.maximum_generations_reach")
}
codeTestChatHelper.addAnswer(
CodeTestChatMessageContent(
message = errorMessage,
Expand Down

0 comments on commit c04de5e

Please sign in to comment.