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

feat(smithy)!: remove error match on http status code #4750

Merged
merged 2 commits into from
Apr 24, 2024

Conversation

Jordan-Nelson
Copy link
Member

@Jordan-Nelson Jordan-Nelson commented Apr 19, 2024

Issue #, if available:

Description of changes:

  • Remove logic in smithy's http operation that maps exceptions based on the http status code alone
  • Update Storage e2e tests to check for the correct exception

Prior to this change smithy contains logic to attempt to determine what type of exception should be thrown based on first the error name/shape (Ex: Access Denied) and then the http status code (ex: 403). The issue with this is that some services (S3) have operations that can return multiple errors for a single status code. For example, a 403 http status code during a GetObject operation can mean AccessDenied OR InvalidObjectState. By mapping based on the http status alone the first exception gets thrown.

With the changes smithy will throw a generic SmithyHttpException when it cannot match the error type based on the name/shape. This allows the consumer (Amplify) to handle the exception as appropriate.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@Jordan-Nelson Jordan-Nelson changed the base branch from main to feat/storage-gen2 April 19, 2024 23:13
@Jordan-Nelson Jordan-Nelson force-pushed the chore/smithy/remove-status-code-match branch 2 times, most recently from eaa31c9 to 8c1a9e6 Compare April 22, 2024 13:05
@Jordan-Nelson Jordan-Nelson changed the title Chore/smithy/remove status code match feat(smithy): remove error match on http status code Apr 22, 2024
@Jordan-Nelson Jordan-Nelson force-pushed the chore/smithy/remove-status-code-match branch from 8c1a9e6 to 83f488b Compare April 24, 2024 01:28
@Jordan-Nelson Jordan-Nelson changed the base branch from feat/storage-gen2 to main April 24, 2024 01:29
@Jordan-Nelson Jordan-Nelson marked this pull request as ready for review April 24, 2024 01:42
@Jordan-Nelson Jordan-Nelson requested a review from a team as a code owner April 24, 2024 01:42
@Jordan-Nelson Jordan-Nelson changed the title feat(smithy): remove error match on http status code feat!: remove error match on http status code Apr 24, 2024
@Jordan-Nelson Jordan-Nelson changed the title feat!: remove error match on http status code feat(smithy)!: remove error match on http status code Apr 24, 2024
@Jordan-Nelson Jordan-Nelson merged commit 7cbffbe into main Apr 24, 2024
289 checks passed
@Jordan-Nelson Jordan-Nelson deleted the chore/smithy/remove-status-code-match branch April 24, 2024 19:20
Equartey pushed a commit that referenced this pull request Apr 25, 2024
* fix!: remove http status code exception mapping

* chore: update remaining test
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.

3 participants