feat(core): Error Handling Revamp (v14)#3140
Open
jonathanedey wants to merge 6 commits into
Open
Conversation
* Initial exports and external api changes * Connect response to error info * feat: Revamp error handling to include `httpResponse` and `cause` in `FirebaseAuthError` and `FirebaseAppError`, added sample tests. * more refactoring * refactor: Update all services to use ErrorInfo format * refactor: Update unit tests to verify error cause and httpResponse population. * chore: fix lint * chore: remove debug tests * fix: Ran api documentor and fix some export errors * fix: Removed outdated `__proto__` workaround and updated api doc strings * chore: Fix lint * fix: Used a helper function to map `RequestResponse` to `HttpResponse` * fix: Removed last of the stringified response bodies in response messages * chore: Fix lint * chore: Generate apidocs * fix: Apply revamp changes to pnv * chore: Added review suggestions
… enable declaration merging (#3127) * chore(auth): Refactor auth error logic * chore(installations): Refactor installations and instance id error logic * chore(fcm): Refactor fcm error logic * fix(auth): Fix auth error mapping that were not copied correctly * fix(auth): Fixed `INVALID_SERVICE_ACCOUNT` to map to a valid client code * chore(pm): Refactor project management error logic * chore: Fix license year for new files * chore(rtdb): Refactor rtdb error logic * chore(fs): Refactor firestore error logic * chore(app): Refactor app error logic * chore(security-rules): Refactor security rules error logic * chore(app-check): Refactor app check error logic * chore(remote-config): Refactor remote config error logic * chore(functions): Refactor functions error logic * chore(extensions): Refactor extensions error logic * chore(fdc): Refactor data connect error logic * chore(ml): Refactor ml error logic * chore(eventarc): Refactor eventarc error logic * chore(fpnv): Refactor pnv error logic * fix: address gemini review * fix: Use Declaration Merging to expose error code constant mapping along side error code type * fix: Address gemini review * chore: Remove extra whitespace
* feat(messaging): Improve HTTP/2 session error handling. * fix: ensure error causes are not lost * fix: clean up stale tests * fix: address gemini review * fix: address more gemini review * fix: Resolve leftover merge issues
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the SDK's error handling system by introducing a standardized ErrorInfo interface that includes HTTP response data and underlying error causes. Service-specific error classes now extend PrefixedFirebaseError and utilize object-based constructors. The messaging service's HTTP/2 logic was also updated to aggregate session errors into batch responses. Feedback identifies opportunities to improve AggregateError serialization in toJSON(), remove the obsolete FirebaseMessagingSessionError class, and refine error message formatting within the HTTP/2 session handler.
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 makes changes the usage and handling of Firebase Errors and includes the following changes:
FirebaseErrorclass.error.tsfiles, utilizing declaration merging to improve IDE autocomplete and indexing.ErrorInfoandHttpResponseclasses for better error handing.ErrorInfoFirebaseErrors:causeandHttpResponse.causeattribute onFirebaseErrorsto allow failing of request at the stream level with context on session error cause.FirebaseMessagingSessionErrorand its logic.This PR had mostly been previously reviewed in: #3102, #3140 and #3126