Skip to content

Commit e404659

Browse files
committed
Detect parsing errors
1 parent 83cbf12 commit e404659

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/__jsonstuff_jsondecode_oct__.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,10 @@ decode_result
238238
decode_json_text (const std::string &json_str) {
239239
Document document;
240240
document.Parse(json_str.c_str ());
241-
// TODO: Check for parsing and validation errors!
241+
if (document.HasParseError ()) {
242+
// TODO: Include details about the parsing failure. Use GetParseError().
243+
error ("JSON parsing error (no details available; sorry)");
244+
}
242245
return decode_recursive (document);
243246
}
244247

0 commit comments

Comments
 (0)