Closed
Description
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
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);
}
return sin;
}
Metadata
Metadata
Assignees
Labels
No labels