Added global try-catch in utest
authorAndriy Gudz <a.gudz@samsung.com>
Mon, 24 Jul 2017 16:51:41 +0000 (19:51 +0300)
committerAndriy Gudz <a.gudz@samsung.com>
Mon, 24 Jul 2017 16:51:41 +0000 (19:51 +0300)
device_core/utest/test_all.cpp

index ba68e09..add2662 100644 (file)
@@ -6,10 +6,22 @@ std::string cloud_host{"coap+tcp://106.125.46.44:5683"};
 
 int main(int argc, char** argv)
 {
-    if (argc > 1 && argv[1][0] != '-')
+    try
     {
-        cloud_host = std::string{"coap+tcp://"} + argv[1] + std::string{":5683"};
+        if (argc > 1 && argv[1][0] != '-')
+        {
+            cloud_host = std::string{"coap+tcp://"} + argv[1] + std::string{":5683"};
+        }
+        ::testing::InitGoogleTest(&argc, argv);
+        return RUN_ALL_TESTS();
     }
-    ::testing::InitGoogleTest(&argc, argv);
-    return RUN_ALL_TESTS();
+    catch (std::exception& e)
+    {
+        std::cout << "Exception: " << e.what() << std::endl;
+    }
+    catch (...)
+    {
+        std::cout << "Unknown exception" << std::endl;
+    }
+    return -1;
 }