Line | Branch | Exec | Source |
---|---|---|---|
1 | #ifndef EXCEPTIONS_H_AQKXZ8P3 | ||
2 | #define EXCEPTIONS_H_AQKXZ8P3 | ||
3 | |||
4 | #include <QException> | ||
5 | |||
6 | namespace interpreter { | ||
7 | |||
8 | class Exceptions : public QException | ||
9 | { | ||
10 | public: | ||
11 | 1 | virtual QException *clone() const override | |
12 | { | ||
13 | 1 | return new Exceptions(*this); | |
14 | } | ||
15 | |||
16 | 3 | virtual void raise() const override | |
17 | { | ||
18 | 3 | throw *this; | |
19 | } | ||
20 | }; | ||
21 | |||
22 | class UnexpectedMessage : public Exceptions | ||
23 | { | ||
24 | protected: | ||
25 | std::string m_details; | ||
26 | public: | ||
27 | 9 | UnexpectedMessage(QString details) | |
28 | 9 | : Exceptions() | |
29 |
1/2✓ Branch 2 taken 9 times.
✗ Branch 3 not taken.
|
9 | , m_details(details.toStdString()) |
30 | { | ||
31 | 9 | } | |
32 | |||
33 | 11 | UnexpectedMessage(const UnexpectedMessage &other) | |
34 | 11 | : Exceptions(other) | |
35 |
1/2✓ Branch 2 taken 11 times.
✗ Branch 3 not taken.
|
11 | , m_details(other.m_details) |
36 | { | ||
37 | 11 | } | |
38 | |||
39 | 3 | virtual const char *what() const noexcept | |
40 | { | ||
41 | 3 | return m_details.c_str(); | |
42 | } | ||
43 | |||
44 | 1 | virtual QException *clone() const override | |
45 | { | ||
46 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
1 | return new UnexpectedMessage(*this); |
47 | } | ||
48 | |||
49 | 9 | virtual void raise() const override | |
50 | { | ||
51 |
1/2✓ Branch 2 taken 9 times.
✗ Branch 3 not taken.
|
9 | throw *this; |
52 | } | ||
53 | }; | ||
54 | |||
55 | } | ||
56 | |||
57 | #endif /* end of include guard: EXCEPTIONS_H_AQKXZ8P3 */ | ||
58 |