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(auth): throw extended AuthError for service errors from user pool & id pool #14229

Conversation

AllanZhengYP
Copy link
Member

Description of changes

  • Add an optional metadata property to the base AmplifyError class and AuthError class. So customers can inspect the requestId if an AuthError is caused by a service error response.
  • Update the error parser to populate the metadata property when parsing error responses from services. Previously it sets purely internal$metadata property.
  • Fix the 2 identity pool APIs(GetId, GetCredentialsForId) to throw AuthError. Previously, the 2 APIs throw the base Error instance.
  • Update the unit test for identity pool and user pool APIs to verify they all throw AuthError.

Issue #, if available

Description of how you validated changes

Unit tests

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 20, 2025 18:56
@AllanZhengYP AllanZhengYP changed the base branch from main to feat/monitoring-instrument/main February 20, 2025 18:56
Copy link
Member Author

Choose a reason for hiding this comment

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

The diff of this file is messed up, but I only added the 1st test case

@AllanZhengYP AllanZhengYP merged commit 5525a3a into aws-amplify:feat/monitoring-instrument/main Feb 20, 2025
10 of 12 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.

1 participant