blob: 210ef53c3aba7d045e4af5be11331bf1f0575607 [file] [log] [blame]
Patrick Venture035bbbb2018-12-12 14:59:52 -08001#pragma once
2
3#include <exception>
4#include <sstream>
5#include <string>
6
Patrick Venture9b534f02018-12-13 16:10:02 -08007namespace host_tool
8{
9
Patrick Venture035bbbb2018-12-12 14:59:52 -080010class 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 Ventureecfd3002018-12-14 13:57:28 -080019 explicit IpmiException(const std::string& message) : message(message){};
Patrick Venture035bbbb2018-12-12 14:59:52 -080020
21 virtual const char* what() const noexcept override
22 {
23 return message.c_str();
24 }
25
26 private:
27 std::string message;
28};
Patrick Venture9b534f02018-12-13 16:10:02 -080029
30} // namespace host_tool