Skip to content

Commit

Permalink
Make the json exception macro specifiable externally too
Browse files Browse the repository at this point in the history
Thanks, windows
  • Loading branch information
CouleeApps committed Sep 1, 2023
1 parent 3a2115b commit 1882088
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion json/json.h
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,7 @@ class JSON_API Features {
#if !defined(JSON_IS_AMALGAMATION)
#include "forwards.h"
#endif // if !defined(JSON_IS_AMALGAMATION)
#include <stdexcept>
#include <exception>
#include <string>
#include <vector>
Expand Down Expand Up @@ -502,11 +503,12 @@ class JSON_API Features {
#pragma warning(disable : 4251)
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)

#ifndef JSONCPP_EXCEPTION
// XXX: BN: Use our exception class for extra details
#include "../exceptions.h"
#define JSONCPP_EXCEPTION ExceptionWithStackTrace
// #define JSONCPP_EXCEPTION std::runtime_error

#endif

#pragma pack(push, 8)

Expand Down
2 changes: 1 addition & 1 deletion json/jsoncpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2654,7 +2654,7 @@ static inline void releaseStringValue(char* value, unsigned) { free(value); }
namespace Json {

// BN: subclass
Exception::Exception(JSONCPP_STRING const& msg) : JSONCPP_EXCEPTION(msg) {}
Exception::Exception(JSONCPP_STRING const& msg) : JSONCPP_EXCEPTION(msg.c_str()) {}
Exception::~Exception() JSONCPP_NOEXCEPT {}
// BN: removed what()
RuntimeError::RuntimeError(JSONCPP_STRING const& msg) : Exception(msg) {}
Expand Down

0 comments on commit 1882088

Please sign in to comment.