Skip to content

fix: Refactor error logic to remove PrefixedFirebaseError as a intermediate class#3159

Open
jonathanedey wants to merge 5 commits into
error-revampfrom
je-prefix
Open

fix: Refactor error logic to remove PrefixedFirebaseError as a intermediate class#3159
jonathanedey wants to merge 5 commits into
error-revampfrom
je-prefix

Conversation

@jonathanedey
Copy link
Copy Markdown
Collaborator

This PR:

  • Removes the internal PrefixedFirebaseError to directly extend service error classes from the exposed FirebaseError
  • Moves hasCode() helper function to FirebaseError and encapsulate prefix logic in the service error classes
  • Replaces instances of FirebaseError being 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 FirebaseError objects were thrown with hardcoded string prefixes.

@jonathanedey jonathanedey added the release:stage Stage a release candidate label May 22, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/utils/error.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release:stage Stage a release candidate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant