Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -82,6 +82,9 @@
class PromptRefusalException(operation: String, desc: String?, cause: Throwable? = null) :
ClientException(message("amazonqFeatureDev.exception.prompt_refusal"), operation, desc, cause)

class FileCreationFailedException(operation: String, desc: String?, cause: Throwable? = null) :
ServiceException(message("amazonqFeatureDev.exception.failed_generation"), operation, desc, cause)

Check failure on line 86 in plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqFeatureDev/FeatureDevExceptions.kt

View workflow job for this annotation

GitHub Actions / qodana

Invalid property key

'amazonqFeatureDev.exception.failed_generation' doesn't appear to be a valid property key

Check failure

Code scanning / QDJVMC

Invalid property key Error

'amazonqFeatureDev.exception.failed_generation' doesn't appear to be a valid property key
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment below is likely correct. Is there a definition for amazonqFeatureDev.exception.failed_generation in the strings file?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified offline that it does exist


class ThrottlingException(operation: String, desc: String?, cause: Throwable? = null) :
ClientException(message("amazonqFeatureDev.exception.throttling"), operation, desc, cause)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.EmptyPatchExce
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.FEATURE_NAME
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.FeatureDevException
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.FeatureDevOperation
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.FileCreationFailedException
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.GuardrailsException
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.NoChangeRequiredException
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.PromptRefusalException
Expand Down Expand Up @@ -261,6 +262,10 @@ private suspend fun CodeGenerationState.generateCode(
codeGenerationResultState.codeGenerationStatusDetail()?.contains(
"EmptyPatch",
),
-> throw FileCreationFailedException(operation = FeatureDevOperation.GenerateCode.toString(), desc = "File creation failed")
codeGenerationResultState.codeGenerationStatusDetail()?.contains(
"FileCreationFailed",
),
-> {
if (codeGenerationResultState.codeGenerationStatusDetail().contains("NO_CHANGE_REQUIRED")) {
throw NoChangeRequiredException(operation = FeatureDevOperation.GenerateCode.toString(), desc = "No change required")
Expand Down
Loading