X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=src%2Fcommon%2Fexception.cpp;h=241686eaf6f4687038f522ed04ccc8d6d5707239;hb=baac5795bc71176909898f7fcbf59dc822f11f4f;hp=cc0011405a69f37e17711e485e43a050c537295f;hpb=1823e905abb7044e38434cc7d16fdec8545dda1c;p=lttng-tools.git diff --git a/src/common/exception.cpp b/src/common/exception.cpp index cc0011405..241686eaf 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,32 +20,55 @@ 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) { } -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) : +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) +{ +}