File tree 2 files changed +18
-20
lines changed
2 files changed +18
-20
lines changed Original file line number Diff line number Diff line change @@ -37,21 +37,36 @@ namespace Json {
37
37
*
38
38
* We use nothing but these internally. Of course, STL can throw others.
39
39
*/
40
- class JSON_API Exception;
40
+ class JSON_API Exception : public std::exception {
41
+ public:
42
+ Exception (std::string const & msg);
43
+ virtual ~Exception () throw ();
44
+ virtual char const * what () const throw();
45
+ protected:
46
+ std::string const msg_;
47
+ };
48
+
41
49
/* * Exceptions which the user cannot easily avoid.
42
50
*
43
51
* E.g. out-of-memory (when we use malloc), stack-overflow, malicious input
44
52
*
45
53
* \remark derived from Json::Exception
46
54
*/
47
- class JSON_API RuntimeError;
55
+ class JSON_API RuntimeError : public Exception {
56
+ public:
57
+ RuntimeError (std::string const & msg);
58
+ };
59
+
48
60
/* * Exceptions thrown by JSON_ASSERT/JSON_FAIL macros.
49
61
*
50
62
* These are precondition-violations (user bugs) and internal errors (our bugs).
51
63
*
52
64
* \remark derived from Json::Exception
53
65
*/
54
- class JSON_API LogicError;
66
+ class JSON_API LogicError : public Exception {
67
+ public:
68
+ LogicError (std::string const & msg);
69
+ };
55
70
56
71
// / used internally
57
72
void throwRuntimeError (std::string const & msg);
Original file line number Diff line number Diff line change @@ -152,23 +152,6 @@ static inline void releaseStringValue(char* value) { free(value); }
152
152
153
153
namespace Json {
154
154
155
- class JSON_API Exception : public std::exception {
156
- public:
157
- Exception (std::string const & msg);
158
- virtual ~Exception () throw ();
159
- virtual char const * what () const throw();
160
- protected:
161
- std::string const msg_;
162
- };
163
- class JSON_API RuntimeError : public Exception {
164
- public:
165
- RuntimeError (std::string const & msg);
166
- };
167
- class JSON_API LogicError : public Exception {
168
- public:
169
- LogicError (std::string const & msg);
170
- };
171
-
172
155
Exception::Exception (std::string const & msg)
173
156
: msg_(msg)
174
157
{}
You can’t perform that action at this time.
0 commit comments