Make throwRuntimeError/throwLogicError print msg when built with JSON_USE_EXCEPTION=0

This commit is contained in:
bcsgh 2020-03-23 17:34:46 -07:00 committed by Christopher Dunn
parent 5813ab1bc1
commit 91f1553f2c

View File

@ -13,6 +13,7 @@
#include <cmath>
#include <cstddef>
#include <cstring>
#include <iostream>
#include <sstream>
#include <utility>
@ -211,8 +212,14 @@ JSONCPP_NORETURN void throwLogicError(String const& msg) {
throw LogicError(msg);
}
#else // !JSON_USE_EXCEPTION
JSONCPP_NORETURN void throwRuntimeError(String const& msg) { abort(); }
JSONCPP_NORETURN void throwLogicError(String const& msg) { abort(); }
JSONCPP_NORETURN void throwRuntimeError(String const& msg) {
std::cerr << msg << std::endl;
abort();
}
JSONCPP_NORETURN void throwLogicError(String const& msg) {
std::cerr << msg << std::endl;
abort();
}
#endif
// //////////////////////////////////////////////////////////////////