X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Fexception.cpp;h=f1c530f7e4249928541a7603f311dcaac2cbee82;hb=5219e670edb63d5a4b34e095475045e6540f461b;hp=16e27e52afa35ebd4e144363772c839602995e78;hpb=53cd1e2272afac08649dc55e395ec8a5dac20b4e;p=lttng-tools.git diff --git a/src/common/exception.cpp b/src/common/exception.cpp index 16e27e52a..f1c530f7e 100644 --- a/src/common/exception.cpp +++ b/src/common/exception.cpp @@ -11,7 +11,7 @@ namespace { std::string format_throw_location( - const char *file_name, const char *function_name, unsigned int line_number) + const char *file_name, const char *function_name, unsigned int line_number) { std::stringstream location; @@ -20,24 +20,56 @@ std::string format_throw_location( return location.str(); } -} // namespace +} /* namespace */ lttng::ctl::error::error(lttng_error_code error_code, - const char *file_name, - const char *function_name, - unsigned int line_number) : - std::runtime_error(std::string(error_get_str(error_code)) + " " + - format_throw_location(file_name, function_name, line_number)) + const char *file_name, + const char *function_name, + unsigned int line_number) : + runtime_error(std::string(error_get_str(error_code)), file_name, function_name, line_number), + _error_code{error_code} { } -lttng::posix_error::posix_error(const std::string &msg, - int errno_code, - const char *file_name, - const char *function_name, - unsigned int line_number) : +lttng::posix_error::posix_error(const std::string& msg, + int errno_code, + const char *file_name, + const char *function_name, + unsigned int line_number) : std::system_error(errno_code, - std::generic_category(), - msg + " " + format_throw_location(file_name, function_name, line_number)) + std::generic_category(), + msg + " " + format_throw_location(file_name, function_name, line_number)) +{ +} + +lttng::runtime_error::runtime_error(const std::string& msg, + const char *file_name, + const char *function_name, + unsigned int line_number) : + std::runtime_error(msg + " " + format_throw_location(file_name, function_name, line_number)) +{ +} + +lttng::communication_error::communication_error(const std::string& msg, + const char *file_name, + const char *function_name, + unsigned int line_number) : + runtime_error(msg, file_name, function_name, line_number) +{ +} + +lttng::protocol_error::protocol_error(const std::string& msg, + const char *file_name, + const char *function_name, + unsigned int line_number) : + communication_error(msg, file_name, function_name, line_number) +{ +} + +lttng::invalid_argument_error::invalid_argument_error(const std::string& msg, + const char *file_name, + const char *function_name, + unsigned int line_number) : + runtime_error(msg, file_name, function_name, line_number) { }