It would be good to be able to forward an error passed to onFailed to either or both of
- Another QPromise,
- The returned QFuture<T>
Currently, onFailed apparently must return a value of type T, and must accept a statically determined exception type. What would be desirable is
Or (to disambiguate the case where 'p' is thrown as an exception - phew), suggestion by peppe,
The latter fails currently, because Qt tries to determine the parameter type of the lambda, but which is a template here.
It would also desirable to me to forward the error to the returned QFuture<T>. In the following, the "exception catcher" is supposed to work around the above limitation. But then, I would like to forward it to the return future. For example:
Instead, currently "onFailed" always has to return a value of type X, making it impossible to forward an error, or translate an error to a different error. Maybe even allowing to make the lambda return "void" should implicitly make the error be forwarded to the returned future.
Here, the lambda doesn't return anything, so I would expect that on failure, for whatever exception, we get a future in exceptional state.