Skip to content

Commit d77a97d

Browse files
committed
Fixed Error Handling for Async Fetcher Calls
* `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
1 parent 71d0df2 commit d77a97d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

FirebaseFunctions/Sources/Functions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ enum FunctionsConstants {
536536
if error.domain == kGTMSessionFetcherStatusDomain {
537537
localError = FunctionsError(
538538
httpStatusCode: error.code,
539-
body: data,
539+
body: data ?? error.userInfo["data"] as? Data,
540540
serializer: serializer
541541
)
542542
} else if error.domain == NSURLErrorDomain, error.code == NSURLErrorTimedOut {

0 commit comments

Comments
 (0)