-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
continueOnError issue #35
Comments
That's a great suggestion, but there is a weird scenario here, that I would love to discuss. Taking into account that Let me give you an example: let continueTask = task.continueOnSuccessWithTask { (settings: Settings) -> Task<String> in
return self.updateSettingsTask()
}.task.continueOnErrorWith { (error: ErrorType) -> () in
self.showError(error)
} The type of At the current moment cc @grantland @richardjrossiii for discussion |
We have |
I always thought of the error handler as being at the end of the chain, so I didn't consider that situation. I think that putting the error handler at the end of the chain is probably the way its used most of the time, but I agree that enforcing this restriction at the framework level isn't great. I can also see the workaround I proposed suffers from the same issue. I don't see how the current implementation solves it though, without the I like the idea of |
I still feel like my proposed solution provides the flexibility to be able to switch to a void task, or return a result of the same type as the previous task in the chain. The swift compiler is smart enough to pick up any type mismatches. But this way the developer will have the flexibility to decide which way to use it. Or Is the explicit |
Hi @nlutsenko , I think |
The
continueOnErrorWith(continuation:)
method currently requires that a task returning the same type of result as the receiver be returned in the continuation closure. This makes something like this impossible:This produces the compiler error
Declared closure result '()' is incompatible with contextual type 'Settings'
, because thecontinueOnErrorWith(continuation:)
method expects the closure to return aSettings
instance. A similar issue arises with thecontinueOnErrorWithTask(continuation:)
method.A less than ideal workaround is to do this
A proposed fix is to change the method signatures to
The text was updated successfully, but these errors were encountered: