X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Fexception.hpp;h=1efd80359654bb34de8af78708a131cd8b194db2;hb=e9a2bd79cfeb5ec3f246fb0bba0e32823bb1a272;hp=b7e8261ed65217f5652fd88192c37e78c178dd76;hpb=baac5795bc71176909898f7fcbf59dc822f11f4f;p=lttng-tools.git diff --git a/src/common/exception.hpp b/src/common/exception.hpp index b7e8261ed..1efd80359 100644 --- a/src/common/exception.hpp +++ b/src/common/exception.hpp @@ -20,6 +20,8 @@ throw lttng::posix_error(msg, errno_code, __FILE__, __func__, __LINE__) #define LTTNG_THROW_ERROR(msg) \ throw lttng::runtime_error(msg, __FILE__, __func__, __LINE__) +#define LTTNG_THROW_UNSUPPORTED_ERROR(msg) \ + throw lttng::runtime_error(msg, __FILE__, __func__, __LINE__) #define LTTNG_THROW_COMMUNICATION_ERROR(msg) \ throw lttng::communication_error(msg, __FILE__, __func__, __LINE__) #define LTTNG_THROW_PROTOCOL_ERROR(msg) \ @@ -36,6 +38,14 @@ public: unsigned int line_number); }; +class unsupported_error : public std::runtime_error { +public: + explicit unsupported_error(const std::string& msg, + const char *file_name, + const char *function_name, + unsigned int line_number); +}; + namespace ctl { /* Wrap lttng_error_code errors which may be reported through liblttng-ctl's interface. */ class error : public runtime_error { @@ -44,10 +54,14 @@ public: const char *file_name, const char *function_name, unsigned int line_number); - lttng_error_code get_code() const; + + lttng_error_code code() const noexcept + { + return _error_code; + } private: - lttng_error_code _error_code; + const lttng_error_code _error_code; }; } /* namespace ctl */