Skip to content

Commit 1cc96e7

Browse files
committed
Adding requestId if UTG fails at StartTestGeneration API due to validation exception.
1 parent 5470418 commit 1cc96e7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import kotlinx.coroutines.CoroutineScope
1616
import kotlinx.coroutines.Job
1717
import kotlinx.coroutines.delay
1818
import kotlinx.coroutines.launch
19+
import software.amazon.awssdk.core.exception.SdkServiceException
1920
import software.amazon.awssdk.services.codewhispererruntime.model.GetTestGenerationResponse
2021
import software.amazon.awssdk.services.codewhispererruntime.model.Range
2122
import software.amazon.awssdk.services.codewhispererruntime.model.StartTestGenerationResponse
@@ -118,7 +119,7 @@ class CodeWhispererUTGChatManager(val project: Project, private val cs: Coroutin
118119
) {
119120
try {
120121
response = startTestGeneration(
121-
uploadId = createUploadUrlResponse.uploadId(),
122+
uploadId = "", // createUploadUrlResponse.uploadId(),
122123
targetCode = listOf(
123124
TargetCode.builder()
124125
.relativeTargetPath(codeTestResponseContext.currentFileRelativePath.toString())
@@ -144,6 +145,11 @@ class CodeWhispererUTGChatManager(val project: Project, private val cs: Coroutin
144145
} catch (e: Exception) {
145146
LOG.error(e) { "Unexpected error while creating test generation job" }
146147
val errorMessage = getTelemetryErrorMessage(e, CodeWhispererConstants.FeatureName.TEST_GENERATION)
148+
149+
// Sending requestId to telemetry if there is Validation Exception
150+
if (e is SdkServiceException) {
151+
session.startTestGenerationRequestId = e.requestId()
152+
}
147153
throw CodeTestException(
148154
"CreateTestJobError: $errorMessage",
149155
"CreateTestJobError",

0 commit comments

Comments
 (0)