asyncfuture icon indicating copy to clipboard operation
asyncfuture copied to clipboard

How does one error a AsyncFuture::Deferred?

Open remster opened this issue 4 years ago • 1 comments

And how does one communicate that error? Is this what 'cancel' is for? - doesn't sound this way as cancel is the interface of the future not of the promise.

And a related question, having a failed QFuture - how does one "rescue" it? - i.e.: having this chain: return observe(reading).subscribe(updateCache).future(); - suppose reading fails and suppose there is a way of correcting it: return observe(reading).subscribe(updateCache, rescue).future(); the above doesn't work.

remster avatar Apr 24 '20 13:04 remster

There's currently no error handling in AsyncFuture. You can handle errors in the QFuture type using std::variant or std::any. With Qt6 QFuture can handle failures with exceptions. I'm not sure if Qt6's QFuture is compatible with AsyncFuture. There's a bunch of feature overlap. But QFuture doesn't support combine().

vpicaver avatar Feb 12 '21 21:02 vpicaver