-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue23errorcode #27
Issue23errorcode #27
Conversation
Parse errors is represented as enum type `ParseErrorCode`. Error texts are optional for user. Added `GetParseError_En()` in `error/en.h`, user can localize this file into other files. User may dynamically change the locale in runtime.
… tests about error code
I have not added I would like to invite @pah to review this pull request before merge. Thank you. |
👍 As I said in #23, I like this approach. |
Oh. I accidentally closed it without merging. I will try merge it. |
Conflicts: example/condense/condense.cpp include/rapidjson/reader.h test/unittest/readertest.cpp
Fixes #23. Error messages for parsing are changed to error code (
ParseErrorCode
).Therefore, the error codes are possible to be handled by code instead of human.
Also, the text messages are provided optionally. This has two advantages:
Unit tests are modified to verify the error codes of synthetic error cases.
Examples are modified for API changes.
API changes:
const char* Reader::GetParseError() const
.ParseErrorCode Reader::GetParseErrorCode() const
.RAPIDJSON_PARSE_ERROR
RAPIDJSON_PARSE_ERROR_NORETURN
macro. User should customize this macro instead ofRAPIDJSON_PARSE_ERROR
in the past.