aws-sdk-kotlin
aws-sdk-kotlin copied to clipboard
ec2 error modeling
The Ec2 smithy model does not specify errors for operations, however the service does return error codes. These error codes do not map to defined shapes. As it stands, errors returned from Ec2 throw UnknownServiceErrorException. There is a page https://docs.aws.amazon.com/AWSEC2/latest/APIReference/errors-overview.html#CommonErrors which defines errors that may apply to an given operation. We may want to do a model mutation to model these errors or perhaps model one specific error to prevent customers having to deal with UnknownServiceErrorException.
Tracking ticket: P51240884
Recommendation from MD in smithy-codegen:
> [..] Just throw a general client exception type?
Yes this. It's obvious that there are going to be other services and operations like this, so SDKs need a generic way to deal with unknown errors. We discussed this today, but I also recommend provide other metadata like whether it's a client or server error (4xx vs 5xx) along with the other junk like code, and request ID.
Error handling has been updated such that Ec2Exception is thrown rather than UnknownServiceErrorException in my test case. So this ticket would be only to cover modeling the implicit error types described in the ec2 service api docs.
We have no plans to implement this. If the model doesn't contain the errors then a generic Ec2Exception with the corresponding error code will be what is thrown. We don't want to be on the hook for defining all of these custom exceptions and implementing a customization for all of EC2 that try's to map error codes to a more concrete exception. It gives no additional details than the error code already does it just does so through a type rather than a string.
⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.