fix: Export error classes by IchordeDionysos · Pull Request #2151 · firebase/firebase-admin-node
Conversation
Discussion
Expose the FirebaseError classes to enable code like this:
catch (e) { if (e instanceof FirebaseError) { if (e.code === 'auth/' + AuthClientErrorCode.USER_NOT_FOUND.code) { throw new UserNotFoundException({email}); } } throw e; }
Testing
- Make sure all existing tests in the repository pass after your change.
- If you fixed a bug or added a feature, add a new test to cover your code.
API Changes
- At this time we cannot accept changes that affect the public API. If you'd like to help
us make Firebase APIs better, please propose your change in an issue so that we
can discuss it together.
Would love to see this added, it doesn't appear there's another way to easily access the error types from this package?
I agree this is needed and follows the standard JS pattern for checking for a particular error. Error handling is important to good quality code and this library needs to support that also.
@IchordeDionysos this has got out of data with the base branch may need an update
lahirumaramba
changed the title
Expose error classes
fix: Export error classes
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was referenced
Jun 13, 2024This was referenced
Aug 30, 2024This was referenced
Sep 7, 2024This was referenced
Sep 9, 2024This was referenced
Sep 24, 2024This was referenced
Sep 27, 2024This was referenced
Oct 4, 2024This was referenced
Oct 30, 2024This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters