json: give invalid character offset in error msg

This commit is contained in:
Danny Robson 2015-01-18 15:36:43 +11:00
parent b152729cb5
commit d3f098216c

View File

@ -286,8 +286,11 @@ json::parse (const char *start,
%%write init;
%%write exec;
if (!__success)
throw parse_error ("unable to parse json");
if (!__success) {
std::ostringstream os;
os << "unable to parse json at char " << (p - start);
throw parse_error (os.str ());
}
return std::unique_ptr<json::node> (__root);
}