| 1 | #pragma once |
| 2 | |
| 3 | #include <stdexcept> |
| 4 | |
| 5 | namespace hw |
| 6 | { |
| 7 | namespace error |
| 8 | { |
| 9 | struct device_disconnected : public std::runtime_error |
| 10 | { |
| 11 | explicit device_disconnected(const std::string& message) |
| 12 | : std::runtime_error("Device disconnected: " + message) |
| 13 | { |
| 14 | } |
| 15 | }; |
| 16 | |
| 17 | template<typename TException> |
| 18 | void throw_exception(const std::string &msg) |
| 19 | { |
| 20 | TException e(msg); |
| 21 | LOG_PRINT_L0(e.what()); |
| 22 | throw e; |
| 23 | } |
| 24 | } |
| 25 | } |