Files
qtpromise/docs/qtpromise/qpromise/fail.md
Simon Brunel cc29ef3512 Fix docs C++ snippet for the .fail() args
- Fix the wrong lambda format (missing `[]`).
- Make consistent argument naming (`error`).
- Use `const &` when appropriated.
2020-01-04 13:25:19 +01:00

577 B

title
title
.fail

QPromise::fail

Since: 0.1.0

QPromise<T>::fail(Function onRejected) -> QPromise<T>

Shorthand to promise.then(nullptr, onRejected) for handling errors in promise chains, similar to the native C++ catch statement:

promise.fail([](const MyException& error) {
    // {...}
}).fail([](const QException& error) {
    // {...}
}).fail([](const std::exception& error) {
    // {...}
}).fail([]() {
    // {...} catch-all
});

See also: QPromise::then