Skip to content

Commit c77e525

Browse files
Better JSON type mismatch errors (#1147)
This changes the JSON parsing to use a std::variant so there just a single OnValue handler vs OnString/OnNumber/OnBool/OnNull. Previously a mismatched type would say `JSON Error: Unknown value: name at line 3 index 19` or it would say `JSON Error: Unknown value: name` if the name was known but the type of its value was wrong (example: #1146). Now it'll give a much better error message, showing first the full path of the field being parsed, and then saying exactly how the types mismatch: `JSON Error: model:type - Expected a number but saw a string at line 3 index 19`
1 parent d129274 commit c77e525

File tree

3 files changed

+143
-167
lines changed

3 files changed

+143
-167
lines changed

0 commit comments

Comments
 (0)