summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/code/src_corelib_concurrent_qtconcurrentexception.cpp
blob: 8b4d10acb8035d9f3b2c9c5b5c7d544afeed0d9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//! [0]

class MyException : public QtConcurrent::Exception
{
public:
    void raise() const { throw *this; }
    Exception *clone() const { return new MyException(*this); }
};

//! [0]


//! [1]

try  {
    QtConcurrent::blockingMap(list, throwFunction); // throwFunction throws MyException
} catch (MyException &e) {
    // handle exception
}

//! [1]


//! [2]

void MyException::raise() const { throw *this; }

//! [2]


//! [3]

MyException *MyException::clone() const { return new MyException(*this); }

//! [3]