Adding permission check and error throw in C++
[iot2.git] / iotjava / iotrmi / C++ / sample / TestClass_Skeleton.cpp
index 4fcfe314ba75034868a79065b32b4051f23cbc81..e16c727dcc04c0dc237fb14ce3802c6ecf5503f3 100644 (file)
@@ -7,10 +7,15 @@ using namespace std;
 
 int main(int argc, char *argv[])
 {
 
 int main(int argc, char *argv[])
 {
-
-       int port = 5010;
-       TestClassInterface *tc = new TestClass(3, 5.0, "7911");
-       TestClass_Skeleton *tcSkel = new TestClass_Skeleton(tc, port);
+       TestClassInterface *tc;
+       TestClass_Skeleton *tcSkel;
+       try {
+               int port = 5010;
+               tc = new TestClass(3, 5.0, "7911");
+               tcSkel = new TestClass_Skeleton(tc, port);
+       } catch(const exception&) {
+               return EXIT_FAILURE;
+       }
        //tcSkel->waitRequestInvokeMethod();
 
        delete tc;
        //tcSkel->waitRequestInvokeMethod();
 
        delete tc;