Skip to content

Commit 9376368

Browse files
committed
use Json::LogicError in macros
1 parent 5383794 commit 9376368

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

include/json/assertions.h

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,25 @@
1818
* for pre-condition violations and internal logic errors.
1919
*/
2020
#if JSON_USE_EXCEPTION
21-
#include <stdexcept>
22-
#define JSON_ASSERT(condition) \
23-
{if (!(condition)) {throw std::logic_error( "assert json failed" );}} // @todo <= add detail about condition in exception
24-
#define JSON_FAIL_MESSAGE(message) \
21+
22+
// @todo <= add detail about condition in exception
23+
# define JSON_ASSERT(condition) \
24+
{if (!(condition)) {Json::throwLogicError( "assert json failed" );}}
25+
26+
# define JSON_FAIL_MESSAGE(message) \
2527
{ \
2628
std::ostringstream oss; oss << message; \
27-
throw std::logic_error(oss.str()); \
29+
Json::throwLogicError(oss.str()); \
30+
abort(); \
2831
}
29-
//#define JSON_FAIL_MESSAGE(message) throw std::logic_error(message)
32+
3033
#else // JSON_USE_EXCEPTION
31-
#define JSON_ASSERT(condition) assert(condition)
34+
35+
# define JSON_ASSERT(condition) assert(condition)
3236

3337
// The call to assert() will show the failure message in debug builds. In
3438
// release builds we abort, for a core-dump or debugger.
35-
#define JSON_FAIL_MESSAGE(message) \
39+
# define JSON_FAIL_MESSAGE(message) \
3640
{ \
3741
std::ostringstream oss; oss << message; \
3842
assert(false && oss.str().c_str()); \

0 commit comments

Comments
 (0)