-
Notifications
You must be signed in to change notification settings - Fork 38.7k
rpc: Adjust RPCTypeCheckObj error string #26240
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
rpc: Adjust RPCTypeCheckObj error string #26240
Conversation
maflcko
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.
I don't follow the changes. The changes shouldn't change any logic, but only adjust a format string
I might have misunderstood the issue, but it mentions the unification of the error string. |
edf89d2 to
8a495b9
Compare
maflcko
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.
Thanks. Lgtm, feel free to ignore the nit
|
Please squash your commits according to https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#squashing-commits |
7a80633 to
1640a5e
Compare
1640a5e to
db21879
Compare
furszy
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.
Code ACK db218795
Need to cleanup the commit message, it's currently saying "rpc: Adjust RPCTypeCheckObj error string" three times.
db21879 to
2b5fcc2
Compare
furszy
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.
Something that #26214 isn't stating is that, with this change, we will remove the name of the invalid arg in the returned error description.
e.g. the user will receive a general "JSON value of type string is not of expected type number". When before, was receiving the name of the invalid parameter: "Expected type number for conf_target, got string".
I'm more inclined to add the invalid parameter name into the RPCTypeCheckArgument error string rather than remove it from RPCTypeCheckObj. It's useful to quickly detect which arg type is wrong when you type a long command.
This refactor could be done in a follow-up PR, but if we are agree over this point, then instead of calling RPCTypeCheckArgument inside RPCTypeCheckObj, we can just change the returned string to be:
strprintf("JSON value of type %s for arg %s is not of expected type %s", uvTypeName(v.type()), t.first, uvTypeName(t.second.type)));
This modification would modify the signature of the function |
|
I'd say to just leave the code logic as it was before and only change the string |
2b5fcc2 to
e0a2cbe
Compare
|
The file |
src/rpc/util.cpp
Outdated
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.
Any reason to remove the {}? According to the dev notes we want them
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.
Any reason to remove the {}? According to the dev notes we want them
Yes, this would also reduce the diff.
aureleoules
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.
ACK e0a2cbe40ce51079472593330f8de39c78397a23 LGTM
src/rpc/util.cpp
Outdated
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.
Any reason to remove the {}? According to the dev notes we want them
Yes, this would also reduce the diff.
e0a2cbe to
2dede9f
Compare
furszy
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.
ACK 2dede9f
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
2dede9f Adjust RPCTypeCheckObj error string (Leonardo Araujo) Pull request description: Unifies the JSON type error strings as mentioned in bitcoin#26214. Also refer to bitcoin#25737. ACKs for top commit: furszy: ACK 2dede9f Tree-SHA512: c918889e347ba32cb6d0e33c0de5956c2077dd40c996151e16741b0c4983ff098c60258206ded76ad7bbec4876c780c6abb494a97e4f1e05717d28a59b9167a6
Unifies the JSON type error strings as mentioned in #26214. Also refer to #25737.