-
Notifications
You must be signed in to change notification settings - Fork 70
feat: add table metadata reader and writer #85
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
Conversation
cb375f1 to
096cd4c
Compare
| Result<nlohmann::json> FromJsonString(const std::string& json_string) { | ||
| try { | ||
| return nlohmann::json::parse(json_string); | ||
| } catch (const std::exception& e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:should we only catch json::parse_error exception?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that the official documentation says it only throws parse_error. I just want to be safe enough to catch all just in case. Or we can add a special branch for parse_error for better error message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also call an overload that doesn't throw an exception, and explicitly check whether the resulting JSON object is discarded() (IIRC)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've created #87 to track it.
| return false; | ||
| } | ||
| for (size_t i = 0; i < lhs.size(); ++i) { | ||
| if (*lhs[i] != *rhs[i]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be null pointer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be null if there is something wrong. Since operator== is only used in the test case, it should be fine. I can add a NullSafeEquals later if this is required.
zhjwpku
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks
|
Thanks @wgtmac for working on this, and thanks @lidavidm, @zhjwpku and @yingcai-cy for the review 🙌 |
No description provided.