Since: 0.4.0

QPromise<T>::tapFail(Function handler) -> QPromise<T>

This handler allows to observe errors of the input promise without handling them - similar to finally but only called on rejections. The output promise has the same type as the input one but also the same value or error. However, if handler throws, output is rejected with the new exception.

QPromise<int> input = {...}
auto output = input.tapFail([](Error err) {
}).then([](int res) {
    return process(res);
}).fail([](Error err) {
    return -1;

If handler returns a promise (or QFuture), the output promise is delayed until the returned promise is resolved and under the same conditions: the delayed value is ignored, the error transmitted to the output promise.

Last Updated: 9/9/2018, 8:55:07 AM