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 | /*! |
21 | * \class ThreadWeaver::Exception |
22 | * \inheaderfile ThreadWeaver/Exception |
23 | * \inmodule ThreadWeaver |
24 | */ |
25 | class THREADWEAVER_EXPORT Exception : public std::runtime_error |
26 | { |
27 | public: |
28 | /*! |
29 | */ |
30 | explicit Exception(const QString &message = QString()); |
31 | ~Exception() throw() override; |
32 | /*! |
33 | */ |
34 | QString message() const; |
35 | |
36 | private: |
37 | QString m_message; |
38 | }; |
39 | |
40 | /*! |
41 | * \class ThreadWeaver::JobAborted |
42 | * \inheaderfile ThreadWeaver/Exception |
43 | * \inmodule ThreadWeaver |
44 | */ |
45 | class THREADWEAVER_EXPORT JobAborted : public Exception |
46 | { |
47 | public: |
48 | /*! |
49 | */ |
50 | explicit JobAborted(const QString &message = QString()); |
51 | }; |
52 | |
53 | /*! |
54 | * \class ThreadWeaver::JobFailed |
55 | * \inheaderfile ThreadWeaver/Exception |
56 | * \inmodule ThreadWeaver |
57 | */ |
58 | class THREADWEAVER_EXPORT JobFailed : public Exception |
59 | { |
60 | public: |
61 | /*! |
62 | */ |
63 | explicit JobFailed(const QString &message = QString()); |
64 | }; |
65 | |
66 | // test: |
67 | /*! |
68 | * \class ThreadWeaver::AbortThread |
69 | * \inheaderfile ThreadWeaver/Exception |
70 | * \inmodule ThreadWeaver |
71 | */ |
72 | class AbortThread : public Exception |
73 | { |
74 | public: |
75 | /*! |
76 | */ |
77 | AbortThread(const QString &message = QString()); |
78 | }; |
79 | |
80 | } |
81 | |
82 | #endif // EXCEPTION_H |
83 | |