fix: Refactor error logic to remove PrefixedFirebaseError as a intermediate class#3159
Open
jonathanedey wants to merge 5 commits into
Open
fix: Refactor error logic to remove PrefixedFirebaseError as a intermediate class#3159jonathanedey wants to merge 5 commits into
PrefixedFirebaseError as a intermediate class#3159jonathanedey wants to merge 5 commits into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the error handling system by removing the PrefixedFirebaseError class and integrating its functionality directly into the base FirebaseError class. It introduces a new hasCode method to FirebaseError to allow checking error codes without explicit knowledge of service prefixes. Additionally, it defines new error code constants and types for the Database, Firestore, and Storage services. Feedback was provided regarding the hasCode implementation, noting that it should check against the full error code before attempting a prefixed match to ensure consistent behavior and support polymorphism.
This 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR:
PrefixedFirebaseErrorto directly extend service error classes from the exposedFirebaseErrorhasCode()helper function toFirebaseErrorand encapsulate prefix logic in the service error classesFirebaseErrorbeing used with a manual service error prefix.This PR also creates specific error classes for Database, Firestore, Storage, and Machine Learning, replacing legacy instances where generic
FirebaseErrorobjects were thrown with hardcoded string prefixes.