-
Notifications
You must be signed in to change notification settings - Fork 38
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
[#491] Propagate error strings from iceoryx2 via CXX API #506
base: main
Are you sure you want to change the base?
[#491] Propagate error strings from iceoryx2 via CXX API #506
Conversation
C_IS_BEING_CREATED_BY_ANOTHER_INSTANCE, | ||
C_OLD_CONNECTION_STILL_ACTIVE, |
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.
This error doesn't exist in the iceoryx2 error enum.
d77726c
to
ab23edf
Compare
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.
Good work and congratulations to the proc macro!
The only thing here is, that I would follow the iceoryx type conversion approach here and use from<EnumType, const char*>
since it is a conversion from enum to a string. In this way it is nicely consistent.
@@ -25,6 +25,9 @@ enum class ConfigCreationError : uint8_t { | |||
/// Parts of the config file could not be deserialized. Indicates some kind of syntax error. | |||
UnableToDeserializeContents | |||
}; | |||
|
|||
auto error_string(const iox2::ConfigCreationError& error) -> const char*; |
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.
We should use here the From
approach like it is done here: https://github.com/eclipse-iceoryx/iceoryx2/blob/main/iceoryx2-ffi/cxx/include/iox2/enum_translation.hpp
Since it is a conversion from enum iox2::ConfigCreationError
to const char*
.
This applies to all error_string()
free functions.
|
||
namespace iox2 { | ||
|
||
auto error_string(const iox2::ConfigCreationError& error) -> const char* { |
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.
All those implementation should be changed to the format:
template <>
constexpr auto from<iox2::ConfigCreationError, const char *>(const iox2::ConfigCreationError value) noexcept -> const char * {
return iox2_config_creation_error_string(iox::into<iox2_config_creation_error_e>(value));
}
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 you also rename the file into enum_string.cpp
. It makes sense to have this conversion also for non error enums like ServiceType
for instance.
Notes for Reviewer
Adds C/C++ API to retrieve pointer to string describing iceoryx2 errors.
Pre-Review Checklist for the PR Author
SPDX-License-Identifier: Apache-2.0 OR MIT
iox2-123-introduce-posix-ipc-example
)[#123] Add posix ipc example
)task-list-completed
)Checklist for the PR Reviewer
Post-review Checklist for the PR Author
References
Closes #491