Bridge FirebaseFunctionsException to an iOS-shaped NSError#95
Open
vincentborko wants to merge 1 commit into
Open
Bridge FirebaseFunctionsException to an iOS-shaped NSError#95vincentborko wants to merge 1 commit into
vincentborko wants to merge 1 commit into
Conversation
Cloud Functions failures on Android were wrapped in a generic ErrorException
with no domain/code, so callers could not classify them the way they can on
iOS (FIRFunctionsErrorDomain + gRPC status codes) or the way Firestore already
does here (FIRFirestoreErrorDomain).
Mirror the Firestore pattern: add FunctionsErrorDomain ("com.firebase.functions",
matching iOS), a FunctionsErrorCode enum (canonical gRPC codes 0–16), and
asNSError(functionsException:). Both call() overloads now surface the mapped
NSError. The Android Code enum is declared in gRPC order, so its `ordinal` is
the code value (Firestore's Code exposes value(); Functions' does not).
Lets consumers detect e.g. unavailable(14)/deadlineExceeded(4) to treat a
Functions timeout / backend-unreachable as expected connectivity rather than
an actionable error.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EncjCGPMYW8P7TDqgoJpmD
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.
On Android, Cloud Functions failures are wrapped in a generic
ErrorExceptionwith no domain or code, so consumers can't classify them the way they can on iOS (FIRFunctionsErrorDomain+ gRPC status codes) — or the way this wrapper already bridges Firestore (FIRFirestoreErrorDomain).This mirrors the existing
asNSError(firestoreException:)for Functions:FunctionsErrorDomain = "com.firebase.functions"(matches iOS)FunctionsErrorCodeenum — canonical gRPC codes 0–16 (same numbering asFirestoreErrorCodeand iOSFunctionsErrorCode)asNSError(functionsException:)— maps the exception. Firestore'sCodeexposesvalue(); the FunctionsCodedoes not, but the enum is declared in gRPC order, so itsordinalequals the code value.Both
call()overloads (async + completion) now surface the mappedNSErrorinstead of the opaque wrapper, letting callers detect e.g.unavailable(14) /deadlineExceeded(4) and treat a Functions timeout / backend-unreachable as expected connectivity rather than an actionable error.Verified building green in a consuming Skip app (Android
assembleDebug):libSkipFirebaseFunctions.sorebuilds with the bridge and a downstream domain/code classifier compiles against it on Android + iOS.