New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding Error message to chat window if UploadArtifactToS3 fails in Gumby #4339
Conversation
...mmunity/src/software/aws/toolkits/jetbrains/services/codemodernizer/CodeModernizerSession.kt
Outdated
Show resolved
Hide resolved
...mmunity/src/software/aws/toolkits/jetbrains/services/codemodernizer/CodeModernizerSession.kt
Outdated
Show resolved
Hide resolved
...mmunity/src/software/aws/toolkits/jetbrains/services/codemodernizer/CodeModernizerSession.kt
Outdated
Show resolved
Hide resolved
@@ -369,6 +369,13 @@ class CodeModernizerManager(private val project: Project) : PersistentStateCompo | |||
) | |||
} | |||
|
|||
is CodeModernizerStartJobResult.UploadArtifactToS3Failure -> { | |||
CodeModernizerJobCompletedResult.UnableToCreateJob( | |||
message("codemodernizer.notification.warn.unable_to_start_job_due_to_upload_failure"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs to be:
message("codemodernizer.notification.warn.unable_to_start_job_due_to_upload_failure", URL)
to replace the {0}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We dont need to pass here I think so as this will be retrieved directly from https://github.com/aws/aws-toolkit-jetbrains/pull/4339/files#diff-d5d5f0160522116b64d9ad48daa882f8f802d086797a0bfc86cc0363b1f43c3eR158
As I followed the above CodeModernizerStartJobResult.UnableToStartJob
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's going to be retrieved, I've never used it like that
plugins/toolkit/resources/resources/software/aws/toolkits/resources/MessagesBundle.properties
Show resolved
Hide resolved
...mmunity/src/software/aws/toolkits/jetbrains/services/codemodernizer/CodeModernizerManager.kt
Show resolved
Hide resolved
@@ -154,7 +154,9 @@ class CodeModernizerSession( | |||
} catch (e: Exception) { | |||
state.putJobHistory(sessionContext, TransformationStatus.FAILED) | |||
state.currentJobStatus = TransformationStatus.FAILED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to discern if we can modify e: Exception
to some sort of AWS SDK error object like AwsServiceException
-> https://docs.aws.amazon.com/sdk-for-kotlin/latest/developer-guide/error-handling.html
You should be able to do some error handling for this type of error object and directly report this on a 403 with:
} catch(e: AwsServiceException) {
if (e.statusCode() === 403 && e.awsErrorDetails().serviceName() === "S3") {
CodeModernizerStartJobResult.UnabletoStartOrUploadJob(
"https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/security_iam_manage-access-with-policies.html")
} else {
CodeModernizerStartJobResult.UnableToStartJob(e.message.toString())
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not exactly sure about the service name string, but since startJob
and s3Upload
are in the same try/catch, we could possibly use this to discern the difference between the two.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rli Is the AwsServiceException
the right way to capture AWS SDK specific issues in Kotlin?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
S3Exception
/ CodeWhisperer[Streaming]Exception
?
avoid introspecting status codes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall I go with S3Exception
or AwsServiceException
to capture the upload failure to S3? @damntrecky
@@ -7,6 +7,7 @@ sealed class CodeModernizerStartJobResult { | |||
data class ZipCreationFailed(val reason: String) : CodeModernizerStartJobResult() | |||
data class Started(val jobId: JobId) : CodeModernizerStartJobResult() | |||
data class UnableToStartJob(val exception: String) : CodeModernizerStartJobResult() | |||
data class UnabletoStartOrUploadJob(val url: String) : CodeModernizerStartJobResult() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change this to UnabletoUploadJob
and we can keep UnableToStartJob
a separate error.
Quality Gate passedIssues Measures |
Types of changes
Description
Solution
uploadArtifactToS3
in Gumby .Checklist
License
I confirm that my contribution is made under the terms of the Apache 2.0 license.