boostorg / boostorg/property_tree
Error handing of JSON parsing not expresive
- Dominant language
- C++
- Stars
- 65
- Forks
- 97
- PR merge metrics
- No merged PRs in 30d
Description
The error handling of parsing JSON is not expressive enough in order to solve related problems.
Looking at https://www.boost.org/doc/libs/1_59_0/boost/property_tree/detail/json_parser/parser.hpp
void parse_escape(), we fail the function with parse_error("invalid escape sequence");
Unfortunately, if all your JSON is on a single line, this tells you that there is a problem on line 1.
To make this message more usable, it would make sense to not only store the line number, though also the column number, so we can check which character is incorrectly escaped. In an ideal world, the exception would even contain that character.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in boost/property_tree/detail/json_parser/parser.hpp at parse_escape() and the parse_error("invalid escape sequence") path. Trace how parser location data is stored and reported, then verify that malformed escapes expose a useful column and, if feasible, the offending character in the exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 40/100