Prevent crash in /forgot-password by safely accessing error response#738
Prevent crash in /forgot-password by safely accessing error response#738Siddhi-sahu wants to merge 2 commits into
Conversation
WalkthroughThe change updates the error handling logic in the forgot password page. Specifically, the code now uses optional chaining to safely access nested error properties and provides a default fallback error message. This prevents runtime crashes that could occur if the expected error structure is missing or undefined. There are no changes to exported or public entity declarations or signatures. Changes
Assessment against linked issues
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
|



Summary
This PR fixes an unhandled runtime error that occurred in the /forgot-password flow. The app was trying to read
error.response.data.params.errwithout checking ifresponseexists, which caused a crash whenresponsewas undefined (e.g., during a network failure).Closes #737
Before
The app crashed with:
After
Graceful error handling with a toast message instead of crashing.

Why
To avoid confusing crashes for users and ensure smoother UX in edge cases like network issues.
Changes
?.)'Something went wrong'if the expected message is unavailablesidenote
I looked through all of the code base, which was huge and found this one inconsistency, took me hours so i hope i can get an acknowledgement.
Summary by CodeRabbit