mirror of
https://github.com/simonbrunel/qtpromise.git
synced 2025-05-02 16:17:50 +08:00
Split the root README.md in multiple Markdown files (in the `docs/` folder) to make easier reading, editing and extending the documentation. An online version is also available on netlify (https://qtpromise.netlify.com). Building it requires Node.js installed, then: - npm install -g gitbook-cli - gitbook install ./ - gitbook build . dist/docs
20 lines
416 B
Markdown
20 lines
416 B
Markdown
## `QPromise<T>::fail`
|
|
|
|
```
|
|
QPromise<T>::fail(Function onRejected) -> QPromise<T>
|
|
```
|
|
|
|
Shorthand to `promise.then(nullptr, onRejected)`, similar to the [`catch` statement](http://en.cppreference.com/w/cpp/language/try_catch):
|
|
|
|
```cpp
|
|
promise.fail([](const MyException&) {
|
|
// {...}
|
|
}).fail(const QException&) {
|
|
// {...}
|
|
}).fail(const std::exception&) {
|
|
// {...}
|
|
}).fail() {
|
|
// {...} catch-all
|
|
});
|
|
```
|