From: Andriy Gudz Date: Mon, 24 Jul 2017 16:51:41 +0000 (+0300) Subject: Added global try-catch in utest X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=14c97f698dacf2692b0c3b659fcbdae7e8d5565f;p=platform%2Fcore%2Fsecurity%2Fsuspicious-activity-monitor.git Added global try-catch in utest --- diff --git a/device_core/utest/test_all.cpp b/device_core/utest/test_all.cpp index ba68e09..add2662 100644 --- a/device_core/utest/test_all.cpp +++ b/device_core/utest/test_all.cpp @@ -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; }