Fix: lttng-destroy: string formating error when default session is unset
[lttng-tools.git] / src / bin / lttng / commands / start.cpp
index f78d3e708aa80c0fd05865cd36ef965ada3790e8..f00ce973e39c59034dec8c3c270d7bd229ab496f 100644 (file)
@@ -7,6 +7,7 @@
 
 #define _LGPL_SOURCE
 #include "../command.hpp"
+#include "../exception.hpp"
 #include "../utils.hpp"
 
 #include <common/exception.hpp>
@@ -117,6 +118,14 @@ cmd_error_code start_tracing(const lttng::cli::session_spec& spec)
                                lttng_strerror(-ctl_exception.code()));
                        listing_failed = true;
                        return {};
+               } catch (const lttng::cli::no_default_session_error& cli_exception) {
+                       /*
+                        * The retrieval of the default session name already logs
+                        * an error when it fails. There is no value in printing
+                        * anything about this exception.
+                        */
+                       listing_failed = true;
+                       return {};
                }
        }();
 
This page took 0.023205 seconds and 4 git commands to generate.