1 | /* -*- C++ -*- |
2 | Base class for exceptions in ThreadWeaver. |
3 | |
4 | SPDX-FileCopyrightText: 2005-2013 Mirko Boehm <mirko@kde.org> |
5 | |
6 | SPDX-License-Identifier: LGPL-2.0-or-later |
7 | */ |
8 | |
9 | #ifndef EXCEPTION_H |
10 | #define EXCEPTION_H |
11 | |
12 | #include <stdexcept> |
13 | |
14 | #include <QString> |
15 | |
16 | #include "threadweaver_export.h" |
17 | |
18 | namespace ThreadWeaver |
19 | { |
20 | class THREADWEAVER_EXPORT Exception : public std::runtime_error |
21 | { |
22 | public: |
23 | explicit Exception(const QString &message = QString()); |
24 | ~Exception() throw() override; |
25 | QString message() const; |
26 | |
27 | private: |
28 | QString m_message; |
29 | }; |
30 | |
31 | class THREADWEAVER_EXPORT JobAborted : public Exception |
32 | { |
33 | public: |
34 | explicit JobAborted(const QString &message = QString()); |
35 | }; |
36 | |
37 | class THREADWEAVER_EXPORT JobFailed : public Exception |
38 | { |
39 | public: |
40 | explicit JobFailed(const QString &message = QString()); |
41 | }; |
42 | |
43 | // test: |
44 | class AbortThread : public Exception |
45 | { |
46 | public: |
47 | AbortThread(const QString &message = QString()); |
48 | }; |
49 | |
50 | } |
51 | |
52 | #endif // EXCEPTION_H |
53 | |