Skip to content

Add RetryableTrait to error models - #750

Open
Madrigal wants to merge 2 commits into
mainfrom
feat/retryable-trait
Open

Madrigal wants to merge 2 commits into
mainfrom
feat/retryable-trait

Conversation

@Madrigal

Copy link
Copy Markdown
Contributor

Issue #, if available:
N/A
Description of changes:

We currently don't do codegen for @retryable trait from Smithy docs.

This PR adds support for it.

We discussed adding this to the struct schema, but since we wanted to keep schemas with information only related to serde we'll instead add a new RetryableTrait that adds a trait, present? function. This looks like this when it's not available

 // RetryableTrait returns the error's smithy.api#retryable trait, and
 // whether the error is modeled with the trait.
 func (e *AccessDeniedException) RetryableTrait() (smithytraits.Retryable, bool) {
     return smithytraits.Retryable{}, false
 }

And like this when it is

// RetryableTrait returns the error's smithy.api#retryable trait, and
// whether the error is modeled with the trait.
func (e *ThrottlingException) RetryableTrait() (smithytraits.Retryable, bool) {
    return smithytraits.Retryable{Throttling: true}, true
}

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant