-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
It would be nice if there were a mechanism for reporting the locations of semantic errors (e.g. incorrect value type). It looks like the functionality is almost there with Value::getOffsetStart(). Perhaps something like:
void Reader::pushError(const Value& value, std::string msg);
which would use the Value offset and Reader::begin_ to calculate a Reader::Location and push_back a Reader::ErrorInfo onto Reader::errors_. The error could then be printed with a call to Reader::getFormattedErrorMessages(). Perhaps there could be a:
void Reader::pushError(const Value& value, std::string msg, const Value& extra);
that also initializes Reader::ErrorInfo::extra_.
Of course then it would be nice to have a function
bool Reader::good() const;
to return !Reader::errors_.size().
Soooo, I guess I basically could implement this right now....lol. Expect a pull request shortly.