summaryrefslogtreecommitdiff
path: root/json/json.h
diff options
context:
space:
mode:
authorGlenn Smith <glenn@vector35.com>2023-09-01 00:28:41 -0400
committerAlexander Taylor <ajtaylor@fuzyll.com>2023-09-01 13:18:59 -0400
commit3a2115bcdcfbca0432afad84f4877187f72514a2 (patch)
treec33d689280b37e2c04d6f655d6ea66e4adc26fbd /json/json.h
parent9cc14bb1edbd111530ee1e936fe5e59de9450832 (diff)
Make asserts from jsoncpp more descriptive
Diffstat (limited to 'json/json.h')
-rw-r--r--json/json.h16
1 files changed, 10 insertions, 6 deletions
diff --git a/json/json.h b/json/json.h
index da91470a..399de6ca 100644
--- a/json/json.h
+++ b/json/json.h
@@ -502,6 +502,12 @@ public:
#pragma warning(disable : 4251)
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
+// XXX: BN: Use our exception class for extra details
+#include "../exceptions.h"
+#define JSONCPP_EXCEPTION ExceptionWithStackTrace
+// #define JSONCPP_EXCEPTION std::runtime_error
+
+
#pragma pack(push, 8)
/** \brief JSON (JavaScript Object Notation).
@@ -512,14 +518,12 @@ namespace Json {
*
* We use nothing but these internally. Of course, STL can throw others.
*/
-class JSON_API Exception : public std::exception {
+class JSON_API Exception : public JSONCPP_EXCEPTION /* BN: subclass changed */ {
public:
Exception(JSONCPP_STRING const& msg);
~Exception() JSONCPP_NOEXCEPT JSONCPP_OVERRIDE;
- char const* what() const JSONCPP_NOEXCEPT JSONCPP_OVERRIDE;
-
-protected:
- JSONCPP_STRING msg_;
+ // BN: Member removed
+ // BN: what() removed
};
/** Exceptions which the user cannot easily avoid.
@@ -2222,7 +2226,7 @@ JSON_API JSONCPP_OSTREAM& operator<<(JSONCPP_OSTREAM&, const Value& root);
#define JSON_ASSERT(condition) \
{ \
if (!(condition)) { \
- Json::throwLogicError("assert json failed"); \
+ Json::throwLogicError(#condition); \
} \
}