OCPlatform::Configure(config);
}
-int processUserInput(int min, int max)
+void processUserInput(int min, int max)
{
assert(min <= max);
if (!std::cin.fail())
{
if (input == max + 1) exit(0);
- if (min <= input && input <= max) return input;
+ if (min <= input && input <= max) return;
}
std::cin.clear();
std::cout << "2. Quit \n";
std::cout << "======================================================== \n";
- processUserInput(1, numMenu);
- runFunc();
+ try
+ {
+ processUserInput(1, numMenu);
+ runFunc();
+ }
+ catch(std::exception & e)
+ {
+ std::cout << e.what() << std::endl;
+ }
}
void runMenu(Menu menu)
{
configurePlatform();
- discoverResource();
+ try
+ {
+ discoverResource();
+ }
+ catch(std::exception &e)
+ {
+ std::cout << e.what() << std::endl;
+ return 0;
+ }
- runMenu(CREATE_REMOTE_SCENE_LIST);
+ try
+ {
+ runMenu(CREATE_REMOTE_SCENE_LIST);
+ }
+ catch(std::exception &e)
+ {
+ std::cout << e.what() << std::endl;
+ return 0;
+ }
while (true) { }
std::cout << "Stopping the scene client" << std::endl;
return 0;
-}
\ No newline at end of file
+}
{
CAEndpoint_t ** netInfo = (CAEndpoint_t **)OICMalloc(sizeof(CAEndpoint_t*)*5);
+ if(netInfo == nullptr)
+ {
+ throw RCSException("memory allocation fail");
+ }
+
uint32_t size = 0;
CAGetNetworkInformation(netInfo, &size);
throw RCSException("Fail to create RCSResourceObject");
}
}
+
}
}