.gitignore: ignore local vscode workspace settings file
[lttng-tools.git] / src / bin / lttng / commands / start.cpp
index 2552062e5bff43e6f0f8c4d9418b50cc741fdcd9..f00ce973e39c59034dec8c3c270d7bd229ab496f 100644 (file)
@@ -7,6 +7,7 @@
 
 #define _LGPL_SOURCE
 #include "../command.hpp"
+#include "../exception.hpp"
 #include "../utils.hpp"
 
 #include <common/exception.hpp>
@@ -89,7 +90,7 @@ cmd_error_code start_tracing(const char *session_name)
 
        const int ret = lttng_start_tracing(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));
        }
 
@@ -103,7 +104,7 @@ cmd_error_code start_tracing(const char *session_name)
        return CMD_SUCCESS;
 }
 
-cmd_error_code start_tracing(const lttng::cli::session_spec& spec) noexcept
+cmd_error_code start_tracing(const lttng::cli::session_spec& spec)
 {
        bool had_warning = false;
        bool had_error = false;
@@ -117,6 +118,14 @@ cmd_error_code start_tracing(const lttng::cli::session_spec& spec) noexcept
                                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.026155 seconds and 4 git commands to generate.