Bug report
Link to the source:
|
assertionFailure("Encountered failure result, but no completion handler was defined to handle it: \(error)") |
A completion handler is defined as optional: action: ((Result<T, Error>) -> Void)?,, yet if not included, causes the program to crash with assertionFailure in case of a failure of the Result.
Based on the API, the lack of the completionHandler should not affect program execution in any way (hence, it's optional), and that's why I believe, this behavior is incompatible with the API declaration.
I suggest completely removing the assertionFailure and replacing it with debug logging message.
Versions
Please fill in the versions you're currently using:
apollo-ios SDK version: 0.49.1
- Xcode version:
13.1
- Swift version:
5.5
- Package manager: Any
Steps to reproduce
Try calling static func returnResultAsyncIfNeeded<T>(on callbackQueue: DispatchQueue?, action: ((Result<T, Error>) -> Void)?, result: Result<T, Error>) { with the result that returns failure, on a debug build.
File: https://github.com/apollographql/apollo-ios/blob/main/Sources/Apollo/DispatchQueue%2BOptional.swift
Bug report
Link to the source:
apollo-ios/Sources/Apollo/DispatchQueue+Optional.swift
Line 30 in 4e2a495
A completion handler is defined as optional:
action: ((Result<T, Error>) -> Void)?,, yet if not included, causes the program to crash withassertionFailurein case of afailureof theResult.Based on the API, the lack of the
completionHandlershould not affect program execution in any way (hence, it's optional), and that's why I believe, this behavior is incompatible with the API declaration.I suggest completely removing the
assertionFailureand replacing it with debug logging message.Versions
Please fill in the versions you're currently using:
apollo-iosSDK version:0.49.113.15.5Steps to reproduce
Try calling
static func returnResultAsyncIfNeeded<T>(on callbackQueue: DispatchQueue?, action: ((Result<T, Error>) -> Void)?, result: Result<T, Error>) {with the result that returnsfailure, on adebugbuild.File: https://github.com/apollographql/apollo-ios/blob/main/Sources/Apollo/DispatchQueue%2BOptional.swift