You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a parsing error is encountered, an exception is thrown from parser::expect() indicating the expected token, but not the current parsing position, making it difficult to track down the offending syntax error. It would be nice if the current position (in line and column, if possible) could also be included in the error message.
The text was updated successfully, but these errors were encountered:
This is solved with #301 and will be part of the 3.0.0 release. Parse errors are now indicated with a user-defined exception json::parse_error which has a public member
/*!@brief byte index of the parse errorThe byte index of the last read character in the input file.@note For an input with n bytes, 1 is the index of the first character and n+1 is the index of the terminating null byte or the end of file. This also holds true when reading a byte vector (CBOR or MessagePack).*/constsize_t byte;
You can try the code in the develop branch (note this is unreleased code that is subject to change!).
No worries. I just merged it to develop yesterday and did not add it to the online documentation. I would be happy to hear about your experience with that.
(Once again, please note that this feature will not be "official" until 3.0.0 is released and may change until then!)
When a parsing error is encountered, an exception is thrown from parser::expect() indicating the expected token, but not the current parsing position, making it difficult to track down the offending syntax error. It would be nice if the current position (in line and column, if possible) could also be included in the error message.
The text was updated successfully, but these errors were encountered: