Wrap main functions to handle uncaught exceptions
[lttng-tools.git] / tests / regression / tools / trigger / utils / notification-client.cpp
index f733821588a63995846cb709e7e903ab2ac8cf25..58ac01e6cbb078d688fb811aa22991c9e3bf1a12 100644 (file)
@@ -7,6 +7,8 @@
 
 #include "utils.h"
 
+#include <common/error.hpp>
+
 #include <lttng/action/list-internal.hpp>
 #include <lttng/condition/event-rule-matches.h>
 #include <lttng/lttng.h>
@@ -81,7 +83,7 @@ end:
        return names_match;
 }
 
-int main(int argc, char **argv)
+static int _main(int argc, char **argv)
 {
        int ret;
        int option;
@@ -279,3 +281,13 @@ end:
        free(expected_trigger_name);
        return !!ret;
 }
+
+int main(int argc, char **argv)
+{
+       try {
+               return _main(argc, argv);
+       } catch (const std::exception& e) {
+               ERR_FMT("Unhandled exception caught by notification client: %s", e.what());
+               abort();
+       }
+}
This page took 0.023981 seconds and 4 git commands to generate.