nvidia/cv: Add specialized exception

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2021-10-23 17:11:21 +02:00
parent a822fcf4c7
commit fe4ed123d0
2 changed files with 20 additions and 1 deletions

View file

@ -284,6 +284,25 @@ namespace streamfx::nvidia::cv {
public:
static std::shared_ptr<::streamfx::nvidia::cv::cv> get();
};
class exception : std::runtime_error {
result _code;
public:
exception(const char* what, result code) : std::runtime_error(what), _code(code) {}
exception(const std::string& what, result code) : std::runtime_error(what), _code(code) {}
~exception(){};
inline result code()
{
return _code;
}
inline const char* description()
{
return ::streamfx::nvidia::cv::cv::get()->NvCV_GetErrorStringFromCode(_code);
}
};
} // namespace streamfx::nvidia::cv
P_ENABLE_BITMASK_OPERATORS(::streamfx::nvidia::cv::color_information);