X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fstart.cpp;h=f00ce973e39c59034dec8c3c270d7bd229ab496f;hb=0729ea5558053d5a1a0d7aea51febf63ee1f3b3f;hp=29cff53c2fb1cc0cd3457cde5066159b0e6ba21f;hpb=d5ed3e6f3a8b52d7f2a3e2277873e0f1914ba515;p=lttng-tools.git diff --git a/src/bin/lttng/commands/start.cpp b/src/bin/lttng/commands/start.cpp index 29cff53c2..f00ce973e 100644 --- a/src/bin/lttng/commands/start.cpp +++ b/src/bin/lttng/commands/start.cpp @@ -7,6 +7,7 @@ #define _LGPL_SOURCE #include "../command.hpp" +#include "../exception.hpp" #include "../utils.hpp" #include @@ -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(-ret)); } @@ -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 {}; } }();