X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fstop.cpp;h=9d5533a2175c361be78f159a56628517afed9c13;hb=e8c353ad12851366573d9bfe45d333a9e9ff742d;hp=d2e0bee14e5bc2f504e5a22bcadfaac1dd09de20;hpb=6e11909ebb204e4a0f9651dc6c58f74c8376a094;p=lttng-tools.git diff --git a/src/bin/lttng/commands/stop.cpp b/src/bin/lttng/commands/stop.cpp index d2e0bee14..9d5533a21 100644 --- a/src/bin/lttng/commands/stop.cpp +++ b/src/bin/lttng/commands/stop.cpp @@ -7,6 +7,7 @@ #define _LGPL_SOURCE #include "../command.hpp" +#include "../exception.hpp" #include "../utils.hpp" #include @@ -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(-ret)); } @@ -132,7 +133,7 @@ cmd_error_code stop_tracing(const char *session_name) return CMD_SUCCESS; } -cmd_error_code stop_tracing(const lttng::cli::session_spec& spec) noexcept +cmd_error_code stop_tracing(const lttng::cli::session_spec& spec) { bool had_warning = false; bool had_error = false; @@ -146,6 +147,14 @@ cmd_error_code stop_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 {}; } }();