aws-amplify / amplify-js

A declarative JavaScript library for application development using cloud services.
https://docs.amplify.aws/lib/q/platform/js
Apache License 2.0
9.36k stars 2.1k forks source link

Export Cognito errors so developers can easily reference them in our code #13312

Closed ffxsam closed 2 weeks ago

ffxsam commented 2 weeks ago

Is this related to a new or existing framework?

No response

Is this related to a new or existing API?

Authentication

Is this related to another service?

No response

Describe the feature you'd like to request

It would be great if we could have access (import) the various Cognito exceptions here: https://github.com/aws-amplify/amplify-js/blob/7ddca1bc9fa9d991259466b2d1e391cede1c206d/packages/auth/src/providers/cognito/types/errors.ts

This way, we can have better type safety in our own code, and auto-complete to get a comprehensive list of all possible errors for the various Auth functions.

Describe the solution you'd like

Please export these exceptions so they're available to import from aws-amplify/auth.

Describe alternatives you've considered

Copying and pasting these errors into our own codebase. This isn't ideal, just in case an AWS developer changes or adds new exceptions.

Additional context

No response

Is this something that you'd be interested in working on?

cwomack commented 2 weeks ago

Hey there, @ffxsam and thank you for creating this issue. We'll mark it as a feature request and review it with the team internally, but seems pretty straightforward. Exposing both the types and the errors would be useful since we currently wrap all uncategorized service errors.

cwomack commented 2 weeks ago

Related to #9104

cwomack commented 2 weeks ago

@ffxsam, I've review this with the team internally and we'd like to consolidate this feature request into the existing/older #9104 referenced above. Please feel free to leave any additional comments/context in that issue as needed, but we've captured the details in this one as a criteria for success/implementation for this feature on our side.