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(storage): emit response metadata in applicable error throw sites #14237

Conversation

AllanZhengYP
Copy link
Member

Description of changes

  • Add metadata to StorageError, and make sure all the error thrown caused by erroneous responses includes metadata.
  • Remove extra recoverySuggestion from 404 error

Issue #, if available

Description of how you validated changes

Unit test

Checklist

  • PR description included
  • yarn test passes
  • Unit Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)

Checklist for repo maintainers

  • Verify E2E tests for existing workflows are working as expected or add E2E tests for newly added workflows
  • New source file paths included in this PR have been added to CODEOWNERS, if appropriate

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

@AllanZhengYP AllanZhengYP requested review from cshfang, HuiSF, ashika112 and a team as code owners February 21, 2025 23:26
Comment on lines +90 to +91
// error is always set when statusCode >= 300
throw buildStorageServiceError((await parseXmlError(response))!);
Copy link
Member

@HuiSF HuiSF Feb 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quick nit: this callsite requires consumer to know the implementation details of parseXmlError function to know when to safely use !. Would that make sense to just move the if (response.statusCode < 300) logic out from the parseXmlError and change it to parse2xxXmlError?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This maybe possible but requires some cross-category interface changes. The ErrorParser interface implemented by parseXmlError returns optional parsed error. That's why I added the casting. I can follow-up on this other PR.😃

@AllanZhengYP AllanZhengYP requested a review from HuiSF February 24, 2025 18:16
@AllanZhengYP AllanZhengYP merged commit 9a3346e into aws-amplify:feat/monitoring-instrument/main Feb 24, 2025
28 checks passed
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