Skip to content

Commit 1ab5477

Browse files
committed
fix the customer face error message
1 parent 788a7fd commit 1ab5477

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/CodeWhispererUTGChatManager.kt

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ class CodeWhispererUTGChatManager(val project: Project, private val cs: Coroutin
156156
var finished = false
157157
var testGenerationResponse: GetTestGenerationResponse? = null
158158
var packageInfoList = emptyList<PackageInfo>()
159-
var packageInfo : PackageInfo? = null
160-
var targetFileInfo : TargetFileInfo? = null
159+
var packageInfo: PackageInfo? = null
160+
var targetFileInfo: TargetFileInfo? = null
161161

162162
while (!finished) {
163163
throwIfCancelled(session)
@@ -195,11 +195,19 @@ class CodeWhispererUTGChatManager(val project: Project, private val cs: Coroutin
195195
}
196196
TestGenerationJobStatus.FAILED -> {
197197
LOG.debug { "Test generation failed, package info: $packageInfoList" }
198-
throw CodeTestException(
199-
"TestGenFailedError: " + message("testgen.message.failed"),
200-
"TestGenFailedError",
201-
message("testgen.error.generic_technical_error_message")
202-
)
198+
if (testGenerationResponse.testGenerationJob().jobStatusReason() == null) {
199+
throw CodeTestException(
200+
"TestGenFailedError: " + message("testgen.message.failed"),
201+
"TestGenFailedError",
202+
message("testgen.error.generic_technical_error_message")
203+
)
204+
} else {
205+
throw CodeTestException(
206+
"TestGenFailedError: ${testGenerationResponse.testGenerationJob().jobStatusReason()}",
207+
"TestGenFailedError",
208+
testGenerationResponse.testGenerationJob().jobStatusReason()
209+
)
210+
}
203211
}
204212
else -> {
205213
LOG.debug { "Test generation in progress, progress rate: ${testGenerationResponse.testGenerationJob().progressRate()}" }

0 commit comments

Comments
 (0)