Align error handling & Sign Up claim issues in AsgardeoV2 #307
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose
This pull request improves error handling and validation consistency across both the JavaScript SDK and React components for sign-in and sign-up flows. The main changes include aligning error propagation from backend responses, updating API and form error management in React components, and enhancing input validation logic. These updates help ensure that errors are surfaced with clear context and that validation feedback is consistent for end users.
Error Handling Improvements
failureReasonfield to bothEmbeddedSignInFlowResponseandEmbeddedSignUpFlowResponseinterfaces to provide detailed backend error context when a flow fails. Error extraction in React components now prioritizes this field. [1] [2]failureReasonfield, and are passed asErrorobjects to UI components for consistent display. [1] [2] [3] [4]Form Validation and API Error Management
BaseSignInandBaseSignUpcomponents: renamederrorstofieldErrorsfor clarity, and introduced a dedicatederrorprop for API errors. ThevalidateFormfunction now returnsfieldErrors. [1] [2] [3] [4] [5]errorprop, ensuring users see backend error messages in the interface. [1] [2] [3]Input Validation Enhancements
EMAIL_INPUT, and clarified how touched states are managed for form fields. [1] [2] [3]API Consistency
actionIdtoactionfor consistency with backend expectations. [1] [2]Codebase Cleanup
These changes collectively align error handling between the SDK and UI, improve validation feedback, and make the codebase easier to maintain.
Related Issues
asgardeo/thunderruntime #212Related PRs
Checklist
Security checks