Skip to content

Commit c67d8dd

Browse files
committed
telemetry(amazonq): expose FileCreationFailed exceptions
1 parent 51d038e commit c67d8dd

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqFeatureDev/FeatureDevExceptions.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ class GuardrailsException(operation: String, desc: String?, cause: Throwable? =
8282
class PromptRefusalException(operation: String, desc: String?, cause: Throwable? = null) :
8383
ClientException(message("amazonqFeatureDev.exception.prompt_refusal"), operation, desc, cause)
8484

85+
class FileCreationFailedException(operation: String, desc: String?, cause: Throwable? = null) :
86+
ClientException(message("amazonqFeatureDev.exception.failed_generation"), operation, desc, cause)
87+
8588
class ThrottlingException(operation: String, desc: String?, cause: Throwable? = null) :
8689
ClientException(message("amazonqFeatureDev.exception.throttling"), operation, desc, cause)
8790

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqFeatureDev/session/CodeGenerationState.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,10 @@ private suspend fun CodeGenerationState.generateCode(
261261
codeGenerationResultState.codeGenerationStatusDetail()?.contains(
262262
"EmptyPatch",
263263
),
264+
-> throw FileCreationFailedException(operation = FeatureDevOperation.GenerateCode.toString(), desc = "File creation failed")
265+
codeGenerationResultState.codeGenerationStatusDetail()?.contains(
266+
"FileCreationFailed",
267+
),
264268
-> {
265269
if (codeGenerationResultState.codeGenerationStatusDetail().contains("NO_CHANGE_REQUIRED")) {
266270
throw NoChangeRequiredException(operation = FeatureDevOperation.GenerateCode.toString(), desc = "No change required")

0 commit comments

Comments
 (0)