Skip to content

Commit

Permalink
iox-#1099 Extend example usage of ErrorHandler
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>
  • Loading branch information
mossmaurice committed Mar 30, 2022
1 parent 334a106 commit 6a2c0d2
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ namespace iox
constexpr uint16_t HOOFS_MODULE_IDENTIFIER{1};
constexpr uint16_t POSH_MODULE_IDENTIFIER{2};
constexpr uint16_t C_BINDING_MODULE_IDENTIFIER{3};
// Every identifier larger than USER_DEFINED_MODULE_IDENTIFIER can be used externally
constexpr uint16_t USER_DEFINED_MODULE_IDENTIFIER{256};

constexpr uint8_t ERROR_ENUM_OFFSET_IN_BITS{16};
Expand Down Expand Up @@ -87,10 +88,25 @@ enum class ErrorLevel : uint32_t
/// );
///
/// @code
/// // definition of error_handling.hpp for module 'foo'
/// #define FOO_ERRORS(error) '\'
/// error(PRETTY_CLASS__DIVISION_BY_ZERO)
///
/// enum class FooError : uint32_t
/// {
/// NO_ERROR = FOO_MODULE_IDENTIFIER << ERROR_ENUM_OFFSET_IN_BITS,
/// FOO_ERRORS(CREATE_ICEORYX_ERROR_ENUM)
/// };
///
/// const char* asStringLiteral(const FooError error) noexcept;
///
/// // usage of the module
/// #include "module_foo/error_handling.hpp"
///
/// class PrettyClass {
/// float division(float a, float b) {
/// if ( b == 0.0f ) {
/// errorHandler(Error::PRETTY_CLASS__DIVISION_BY_ZERO);
/// errorHandler(FooError::PRETTY_CLASS__DIVISION_BY_ZERO);
/// }
/// }
/// };
Expand Down

0 comments on commit 6a2c0d2

Please sign in to comment.