diff options
Diffstat (limited to 'src/corelib/doc')
-rw-r--r-- | src/corelib/doc/snippets/code/src_corelib_thread_qexception.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/corelib/doc/snippets/code/src_corelib_thread_qexception.cpp b/src/corelib/doc/snippets/code/src_corelib_thread_qexception.cpp index 723c1630f6..08bbee7dd3 100644 --- a/src/corelib/doc/snippets/code/src_corelib_thread_qexception.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_thread_qexception.cpp @@ -83,3 +83,19 @@ void MyException::raise() const { throw *this; } MyException *MyException::clone() const { return new MyException(*this); } //! [3] + +//! [4] + +try { + auto f = QtConcurrent::run([] { throw MyException {}; }); + // ... +} catch (const QUnhandledException &e) { + try { + if (e.exception()) + std::rethrow_exception(e.exception()); + } catch (const MyException &ex) { + // Process 'ex' + } +} + +//! [4] |