Skip to content

Commit 91f1553

Browse files
bcsghcdunn2001
authored andcommitted
Make throwRuntimeError/throwLogicError print msg when built with JSON_USE_EXCEPTION=0
1 parent 5813ab1 commit 91f1553

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/lib_json/json_value.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <cmath>
1414
#include <cstddef>
1515
#include <cstring>
16+
#include <iostream>
1617
#include <sstream>
1718
#include <utility>
1819

@@ -211,8 +212,14 @@ JSONCPP_NORETURN void throwLogicError(String const& msg) {
211212
throw LogicError(msg);
212213
}
213214
#else // !JSON_USE_EXCEPTION
214-
JSONCPP_NORETURN void throwRuntimeError(String const& msg) { abort(); }
215-
JSONCPP_NORETURN void throwLogicError(String const& msg) { abort(); }
215+
JSONCPP_NORETURN void throwRuntimeError(String const& msg) {
216+
std::cerr << msg << std::endl;
217+
abort();
218+
}
219+
JSONCPP_NORETURN void throwLogicError(String const& msg) {
220+
std::cerr << msg << std::endl;
221+
abort();
222+
}
216223
#endif
217224

218225
// //////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)