Patrick Venture | 035bbbb | 2018-12-12 14:59:52 -0800 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <exception> |
| 4 | #include <sstream> |
| 5 | #include <string> |
| 6 | |
Patrick Venture | 9b534f0 | 2018-12-13 16:10:02 -0800 | [diff] [blame] | 7 | namespace host_tool |
| 8 | { |
| 9 | |
Patrick Venture | 035bbbb | 2018-12-12 14:59:52 -0800 | [diff] [blame] | 10 | class IpmiException : public std::exception |
| 11 | { |
| 12 | public: |
| 13 | explicit IpmiException(int cc) |
| 14 | { |
| 15 | std::ostringstream smessage; |
| 16 | smessage << "Received IPMI_CC: " << cc; |
| 17 | message = smessage.str(); |
| 18 | } |
Patrick Venture | ecfd300 | 2018-12-14 13:57:28 -0800 | [diff] [blame^] | 19 | explicit IpmiException(const std::string& message) : message(message){}; |
Patrick Venture | 035bbbb | 2018-12-12 14:59:52 -0800 | [diff] [blame] | 20 | |
| 21 | virtual const char* what() const noexcept override |
| 22 | { |
| 23 | return message.c_str(); |
| 24 | } |
| 25 | |
| 26 | private: |
| 27 | std::string message; |
| 28 | }; |
Patrick Venture | 9b534f0 | 2018-12-13 16:10:02 -0800 | [diff] [blame] | 29 | |
| 30 | } // namespace host_tool |