Add exception handlings 37/299037/1
authorHwankyu Jhun <h.jhun@samsung.com>
Mon, 18 Sep 2023 22:37:38 +0000 (07:37 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Mon, 18 Sep 2023 22:37:38 +0000 (07:37 +0900)
The generated code can throw InvalidIOException and std::bad_weak_ptr
exceptions. This patch adds exception handlings.

Change-Id: I91e4d1fecab9e4e9a2047efe47f4616a396b9b00
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
benchmark/tool/main.cc

index 8abe412..1fae0e2 100644 (file)
@@ -183,7 +183,16 @@ class Tester {
 }  // namespace
 
 int main(int argc, char** argv) {
-  Tester tester;
-  tester.Run(argc, argv);
+  try {
+    Tester tester;
+    tester.Run(argc, argv);
+  } catch (const rpc_port::BenchmarkProxy::proxy::InvalidIOException& ie) {
+    _E("InvalidIOException occurs");
+    return -1;
+  } catch (const std::bad_weak_ptr& be) {
+    _E("bad_weak_ptr occurs. error(%s)", be.what());
+    return -1;
+  }
+
   return 0;
 }