Conversation
Prepend elements instead of appending them.
| const std::string_view & _error_message, | ||
| const std::string_view & _error_mitigations, | ||
| size_t _nr_parameters, | ||
| const char* const* _parameters); |
There was a problem hiding this comment.
the syntax for the pointer to pointer is a bit weird
There was a problem hiding this comment.
You are right, there was a missing const, added.
|
|
||
| ## Error code collection | ||
|
|
||
| If you want to enable the error code collection (for example in a separate executable), you also need to declare the preprocessor constant `ERROR_MESSAGE_COLLECTION` **before** including the main header file `error_message.h`. |
There was a problem hiding this comment.
Add that you can also set it globally via compiler flags
There was a problem hiding this comment.
and we probably should have an example project, where we show, how to use these flags.
| * | ||
| * @return A string containing all registered error-codes in the following format: | ||
| * @code{.json} | ||
| * [{ "code": "EC_1" , "message": "Error Message 1", |
There was a problem hiding this comment.
- First question, is this the format the crawler expects.
- Second, for the error code, we need to replace underscore with dash.
| * @endcode | ||
| * | ||
| */ | ||
| #define MITIGATIONS(...) MACRO_CHOOSER(MITIGATIONS, __VA_ARGS__)(__VA_ARGS__) |
There was a problem hiding this comment.
We need an example which shows how this get replaced step by step.
| * The class will automatically register itself to the global linked list in the constructor. | ||
| * @endinternal | ||
| */ | ||
| #define DECLARE_ERROR_BUILDER_CLASS_NO_PARAM(EC, EM, MITIG) \ |
There was a problem hiding this comment.
is there any reason that the parameter names of the macro are shortened
| namespace error_reporting { \ | ||
| DECLARE_ERROR_BUILDER_CLASS_NO_PARAM(EC, EM, MITIG) \ | ||
| } \ | ||
| ERROR_MESSAGE_CLASS_INSTANCE_MODIFIER error_reporting::EC##_class EC; \ |
There was a problem hiding this comment.
Should we maybe add the variables itself also to the namespace, such that we don't pollute the default namespace to much.
| #define DECLARE_ERROR_BUILDER_CLASS_NO_PARAM(EC, EM, MITIG) \ | ||
| class EC##_class : public error_message_declaration_internal { \ | ||
| public: \ | ||
| static constexpr std::string_view error_code_str = #EC; \ |
There was a problem hiding this comment.
Do we check somewhere the structure of the error code?
| * Helper macro to retrieve all descriptions as a comma separated list from arguments. | ||
| * @endinternal | ||
| */ | ||
| #define PARAM_DESCR_FUNCTION(...) EXPAND(GET_MACRO(__VA_ARGS__, PARAM_DESCR_FUNCTION5, PARAM_DESCR_FUNCTION5, \ |
There was a problem hiding this comment.
We need an example where this gets replaced step by step.
| * EC.build().setP1(1).setP2(2).str() | ||
| * @endcode | ||
| */ | ||
| #define DECLARE_ERR_MSG_PARAMS(EC, EM, MITIG, ...) \ |
There was a problem hiding this comment.
I think, we need an example, how this looks after all Macros are replaced.
| } | ||
|
|
||
| inline std::string error_message_declaration_internal::str() { | ||
| std::string msg = std::string(error_code) + ": " + std::string(error_message); |
There was a problem hiding this comment.
We need to replace underscore with dashes in the error code.
No description provided.