Skip to content

Commit b3e6f3d

Browse files
committed
1 parent 13e063c commit b3e6f3d

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

include/json/assertions.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,15 @@
1616
#if JSON_USE_EXCEPTION
1717
#include <stdexcept>
1818
#define JSON_ASSERT(condition) \
19-
if (!(condition)) {throw std::logic_error( "assert json failed" );} // @todo <= add detail about condition in exception
20-
#define JSON_FAIL_MESSAGE(message) do{std::ostringstream oss; oss << message; throw std::logic_error(oss.str());}while(0)
19+
{if (!(condition)) {throw std::logic_error( "assert json failed" );}} // @todo <= add detail about condition in exception
20+
#define JSON_FAIL_MESSAGE(message) \
21+
{ \
22+
std::ostringstream oss; oss << message; \
23+
throw std::logic_error(oss.str()); \
24+
}
2125
//#define JSON_FAIL_MESSAGE(message) throw std::logic_error(message)
2226
#else // JSON_USE_EXCEPTION
23-
#define JSON_ASSERT(condition) assert(condition);
27+
#define JSON_ASSERT(condition) assert(condition)
2428

2529
// The call to assert() will show the failure message in debug builds. In
2630
// release bugs we abort, for a core-dump or debugger.

0 commit comments

Comments
 (0)