Skip to content
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

RestXml error members are not always modeled correctly #479

Closed
aajtodd opened this issue Dec 23, 2021 · 2 comments
Closed

RestXml error members are not always modeled correctly #479

aajtodd opened this issue Dec 23, 2021 · 2 comments
Labels
bug This issue is a bug. codegen help wanted We are asking the community to submit a PR to resolve this issue. no-auto-closure We do not want this issue to be automatically closed. p2 This is a standard priority issue

Comments

@aajtodd
Copy link
Contributor

aajtodd commented Dec 23, 2021

Describe the bug

The Message member of errors in smithy needs special casing.

As an example the STS InvalidIdentityTokenException has a member message but the actual response that comes back looks like this:

<ErrorResponse xmlns=\"https://sts.amazonaws.com/doc/2011-06-15/\">
    <Error>
        <Type>Sender</Type>
        <Code>InvalidIdentityToken</Code>
        <Message>No OpenIDConnect provider found in your account for ...</Message>
    </Error>
    <RequestId>5045ca91-1234-567-8910-00a3c906be6c</RequestId>
</ErrorResponse>

Note the capitalization of Message vs the model message.

Expected behavior

InvalidIdentityTokenException.message should contain the message from the response.

Current behavior

Today the message field is correctly parsed by the XML error response deserializer responsible for figuring out error code and other metadata before we parse the specific exception type.

This gets stashed into the sdkErrorMetadata so it is available with some digging, e.g.:

try {

}catch (ex: IdentityTokenException) {
    val metadataMessage = ex.sdkErrorMetadata.errorMessage
    // ideally it is available on the message directly
    val message = ex.message   // currently null
}

Ideally though it should also be parsed by the InvalidIdentityTokenException deserializer.

Steps to Reproduce

Try to call assumeRoleWithWebIdentity using a JWT without having configured an OIDC provider in your account.

Possible Solution

No response

Context

No response

AWS Kotlin SDK version used

0.9.5-beta

Platform (JVM/JS/Native)

JVM

Operating System and version

macos

@aajtodd aajtodd added bug This issue is a bug. codegen labels Dec 23, 2021
@ianbotsf ianbotsf added the good first issue Good for newcomers label Mar 24, 2022
@ianbotsf ianbotsf added the no-auto-closure We do not want this issue to be automatically closed. label Jul 11, 2022
@lauzadis lauzadis added help wanted We are asking the community to submit a PR to resolve this issue. and removed good first issue Good for newcomers labels Nov 28, 2023
@ianbotsf ianbotsf added the p2 This is a standard priority issue label Apr 4, 2024
@lauzadis
Copy link
Member

This issue was fixed in smithy-kotlin PR #1044. Verified this exception message is accessible in ex.message using the latest version of the SDK.

Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. codegen help wanted We are asking the community to submit a PR to resolve this issue. no-auto-closure We do not want this issue to be automatically closed. p2 This is a standard priority issue
Projects
None yet
Development

No branches or pull requests

3 participants