.gitignore: ignore local vscode workspace settings file
[lttng-tools.git] / src / bin / lttng / commands / stop.cpp
index 8b33bd7f4af5e7dc46c2c5b231432c059a0befe2..9d5533a2175c361be78f159a56628517afed9c13 100644 (file)
@@ -7,6 +7,7 @@
 
 #define _LGPL_SOURCE
 #include "../command.hpp"
+#include "../exception.hpp"
 #include "../utils.hpp"
 
 #include <common/exception.hpp>
@@ -91,7 +92,7 @@ cmd_error_code stop_tracing(const char *session_name)
 
        ret = lttng_stop_tracing_no_wait(session_name);
        if (ret < 0) {
-               LTTNG_THROW_CTL(fmt::format("Failed to start session `{}`", session_name),
+               LTTNG_THROW_CTL(lttng::format("Failed to start session `{}`", session_name),
                                static_cast<lttng_error_code>(-ret));
        }
 
@@ -146,6 +147,14 @@ cmd_error_code stop_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.031163 seconds and 4 git commands to generate.