add handler logic to handle SysCableCheck
Add handler logic to handler for SysCableCheck such that it splits the
true IPMI processing from the business logic.
Tested: Only ran unit-tests (added new ones).
Change-Id: Ieec35cc8839dcd3cfb864b68ffbd1a45d1326fee
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/errors.hpp b/errors.hpp
new file mode 100644
index 0000000..7d392a7
--- /dev/null
+++ b/errors.hpp
@@ -0,0 +1,40 @@
+#pragma once
+
+#include <exception>
+#include <string>
+
+namespace google
+{
+namespace ipmi
+{
+
+/**
+ * This can be used by the Handler object to throw an exception and suggest an
+ * IPMI return code to use for the error.
+ */
+class IpmiException : public std::exception
+{
+ public:
+ explicit IpmiException(int ipmicc) :
+ _message("IPMI Code Received: " + std::to_string(ipmicc)),
+ _ipmicc(ipmicc)
+ {
+ }
+
+ virtual const char* what() const noexcept override
+ {
+ return _message.c_str();
+ }
+
+ int getIpmiError() const
+ {
+ return _ipmicc;
+ }
+
+ private:
+ std::string _message;
+ int _ipmicc;
+};
+
+} // namespace ipmi
+} // namespace google