awslabs / aws-sdk-kotlin

Multiplatform AWS SDK for Kotlin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Include additional metadata in AwsException by default

aajtodd opened this issue · comments

Describe the feature

Additional metadata should be included in AwsServiceException.message under specific conditions:

RequestId: always

All service clients inherit from AwsServiceException which exposes sdkErrorMetadata with an extension accessor for requestId.

Callers can get at this and print it out themselves:

try {
    foo.someOperation()
} catch(ex: AwsServiceException) {
     println(ex)
     println("requestId: ${ex.sdkErrorMetadata.requestId}")
}

It would be more convenient and aid debugging to just include this by default in the string representation when requestId is present.

For S3 we should also consider taking this further and including the extended request id (requestId2).

NOTE: Java already does this (as well as extendedRequestId for S3)

Other metadata: if service response does not include a message

When the service returns no exception message at all, available metadata should be used to form a message such as error code, error type, and protocol response. The Java v2 SDK already does this for its service exceptions, which provides more detail to aid users in debugging.

Is your Feature Request related to a problem?

Adding the request id field(s) by default to the string representation of exceptions helps customers debug their applications as well as helps SDK team triage issues. They may not know to dump the request ID or that it is available. Including it by default helps ensure that customers have access to these fields to share with AWS support if need be without having to add additional code or re-instrument their applications and wait for it to fail again to share the additional details.

Including other metadata in the absence of a service-provided error message will aid users in debugging failures.

Proposed Solution

No response

Describe alternative solutions or features you've considered

No response

Acknowledge

  • I may be able to implement this feature request

AWS Kotlin SDK version used

1.0.51

Platform (JVM/JS/Native)

N/A

Operating System and version

N/A

⚠️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.

⚠️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.