You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
is it intentional that operator>> writes to stderr before throwing an exception in 1.8.3? IMHO it shouldn't do that - it's an unexpected side effect, and it messes up the application's error output. Not every bad input to the JSON parser is an error I want logged on stderr. No other JsonCpp function writes anything to stderr before throwing. Also, it didn't do that in 1.8.0. Also, it uses fprintf which it not really C++-like (which makes me hope it's just some forgotten debug output).
I suggest removing the fprintf(stderrr,...), or #ifdefing it out if you really need it.
Thanks
Wolfram
JSONCPP_ISTREAM& operator>>(JSONCPP_ISTREAM& sin, Value& root) {
CharReaderBuilder b;
JSONCPP_STRING errs;
bool ok = parseFromStream(b, sin, &root, &errs);
if (!ok) {
fprintf(stderr,
"Error from reader: %s",
errs.c_str());
throwRuntimeError(errs);
}
returnsin;
}
The text was updated successfully, but these errors were encountered:
But I think it was an accident. The idea was, back then, exceptions could be turned off/on with a macro. A stream operator has no way to indicate failure, so we wrote to stderr in case. But I don't think that has been needed or helpful in many years.
Hi,
is it intentional that
operator>>
writes to stderr before throwing an exception in 1.8.3? IMHO it shouldn't do that - it's an unexpected side effect, and it messes up the application's error output. Not every bad input to the JSON parser is an error I want logged on stderr. No other JsonCpp function writes anything to stderr before throwing. Also, it didn't do that in 1.8.0. Also, it uses fprintf which it not really C++-like (which makes me hope it's just some forgotten debug output).I suggest removing the
fprintf(stderrr,...)
, or#ifdef
ing it out if you really need it.Thanks
Wolfram
The text was updated successfully, but these errors were encountered: