mirror of
https://github.com/saymrwulf/uhd.git
synced 2026-05-16 21:10:10 +00:00
uhd: Added usb_error exception type
This commit is contained in:
parent
8737c550f5
commit
e1672fa7ee
2 changed files with 13 additions and 0 deletions
|
|
@ -98,6 +98,14 @@ namespace uhd{
|
|||
virtual void dynamic_throw(void) const;
|
||||
};
|
||||
|
||||
struct UHD_API usb_error : runtime_error{
|
||||
int _code;
|
||||
usb_error(int code, const std::string &what);
|
||||
virtual unsigned code(void) const { return _code; };
|
||||
virtual usb_error *dynamic_clone(void) const;
|
||||
virtual void dynamic_throw(void) const;
|
||||
};
|
||||
|
||||
struct UHD_API not_implemented_error : runtime_error{
|
||||
not_implemented_error(const std::string &what);
|
||||
virtual unsigned code(void) const;
|
||||
|
|
|
|||
|
|
@ -43,3 +43,8 @@ make_exception_impl("EnvironmentError", environment_error, exception)
|
|||
make_exception_impl("IOError", io_error, environment_error)
|
||||
make_exception_impl("OSError", os_error, environment_error)
|
||||
make_exception_impl("SystemError", system_error, exception)
|
||||
|
||||
usb_error::usb_error(int code, const std::string &what):
|
||||
runtime_error(str(boost::format("%s %d: %s") % "USBError" % code % what)), _code(code) {}
|
||||
usb_error *usb_error::dynamic_clone(void) const{return new usb_error(*this);} \
|
||||
void usb_error::dynamic_throw(void) const{throw *this;}
|
||||
|
|
|
|||
Loading…
Reference in a new issue