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
fix: create consistent interface 'with_node' for API access #10237
fix: create consistent interface 'with_node' for API access #10237
Conversation
6bfc286
to
ccfd3f4
Compare
ccfd3f4
to
0017be3
Compare
-ifndef(EMQX_API_LIB_HRL). | ||
-define(EMQX_API_LIB_HRL, true). | ||
|
||
-define(ERROR_MSG(CODE, REASON), #{code => CODE, message => emqx_misc:readable_error_msg(REASON)}). |
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.
(Maybe for future discussion): I always wondered why we should have all the responses as macros. We do not match against them anywhere, and the performance impact should be neglectable 🤔
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 think it vastly improves readability and consistency, my goal rather is to ONLY use those macros throughout than constructing all those responses by hand.
Or is it, that you would favor function calls instead?
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.
(Also I match against them in my tests)
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.
that you would favor function calls instead?
Yes, I mean
error_msg(Code, Reason) ->
...
vs
-define(ERROR_MSG(CODE, REASON), ...).
0017be3
to
64a1d84
Compare
Fixes EMQX-9138
PR Checklist
Please convert it to a draft if any of the following conditions are not met. Reviewers may skip over until all the items are checked:
changes/{ce,ee}/(feat|perf|fix)-<PR-id>.en.md
and.zh.md
files