You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
Ooh, good catch. Looking at the history I'm not quite clear why that was added, I've got a question in to the person who added it to double check the intention.
Sounds good. It's ok to have it in internal methods, but there is also some other public API method which calls this eventually. Both are with an optional callback, triggering assertion failure if it has completed unsuccessfully.
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 withassertionFailure
in case of afailure
of theResult
.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
13.1
5.5
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 returnsfailure
, on adebug
build.File: https://github.com/apollographql/apollo-ios/blob/main/Sources/Apollo/DispatchQueue%2BOptional.swift
The text was updated successfully, but these errors were encountered: