Content
This examples shows how correct error handling is done for the one minute example.
Each method in ReconstructMe SDK returns an error code based on reme_error_t. This can be used to determine the outcome of the last invocation. In addition, methods such as reme_context_bind_error_info provide more detailed error status information.
Besides polling for error messages, you can register a callback function for logging messages.
Boost is only used to generate examples and is not necessary for working with this SDK.
#include <boost/test/unit_test.hpp>
#include <stdio.h>
BOOST_AUTO_TEST_SUITE(example_reconstructmesdk)
#define OK(s) \
if (s != REME_ERROR_SUCCESS) { \
reme_context_print_errors(c); \
reme_context_destroy(&c); \
exit(-1); \
} \
BOOST_AUTO_TEST_CASE(error_handling_per_method)
{
}
{
switch (sev) {
{
printf("INFO: %s\n", msg);
break;
}
{
printf("WARNING: %s\n", msg);
break;
}
{
printf("ERROR: %s\n", msg);
break;
}
}
}
BOOST_AUTO_TEST_CASE(error_handling_logging)
{
}
BOOST_AUTO_TEST_CASE(error_handling_critical_point)
{
int nerrors;
printf("Number of errors %i \n", nerrors);
char msg[1024];
for (int i = 0; i < nerrors; ++i) {
printf("%i : %s \n", i, msg);
}
}
BOOST_AUTO_TEST_SUITE_END()