Add try-catch statements for handling exceptions 16/248816/1
authorJi-hoon Lee <dalton.lee@samsung.com>
Tue, 1 Dec 2020 04:48:37 +0000 (13:48 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Wed, 2 Dec 2020 10:46:16 +0000 (19:46 +0900)
Change-Id: Ib7309102e3e7a533bc532ff7f20ac75452ac2af9

src/main.cpp

index 33129a9d35eb2a7bcd1eb80271b4a8c9a4cf7711..8b324580ee7c2340e5d63ff8ac58e37822e960aa 100644 (file)
@@ -14,6 +14,7 @@
  * limitations under the License.
  */
 
+#include <exception>
 #include <tizen.h>
 #include <service_app.h>
 
@@ -80,7 +81,12 @@ int main(int argc, char* argv[])
        service_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, service_app_lang_changed, &ad);
        service_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, service_app_region_changed, &ad);
 
-       int ret = service_app_main(argc, argv, &event_callback, ad);
+       int ret = 0;
+       try {
+               ret = service_app_main(argc, argv, &event_callback, ad);
+       } catch (const std::exception& e) {
+               LOGE("Exception caught : %s", e.what());
+       }
        LOGI("Main function exits with : %d", ret);
        return ret;
 }