Skip to content

Commit

Permalink
Fixed Error Handling for Async Fetcher Calls
Browse files Browse the repository at this point in the history
* `GTMSessionFetcher`’s async `beginFetch()` method returns either data or error, but not both (unlike the completion handler-variant)
* Without the data, `processedResponseData(from:error:)` has less details and can’t categorize the error correctly
* However, the same details can be retrieved from the error’s user info
  • Loading branch information
yakovmanshin committed Oct 25, 2024
1 parent 2b63774 commit ff350ee
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion FirebaseFunctions/Sources/Functions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ enum FunctionsConstants {
if error.domain == kGTMSessionFetcherStatusDomain {
localError = FunctionsError(
httpStatusCode: error.code,
body: data,
body: data ?? error.userInfo["data"] as? Data,
serializer: serializer
)
} else if error.domain == NSURLErrorDomain, error.code == NSURLErrorTimedOut {
Expand Down

0 comments on commit ff350ee

Please sign in to comment.