Use more specific ipmi error codes

Most errors in the handler were returning an unsupported code and not a
more specific code articulating the failure.  Update the code to use
more specific errors.

Change-Id: If94c3203a5ff1b0f9269585ccba0f410484178fa
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/main.cpp b/main.cpp
index e58d193..4f3020c 100644
--- a/main.cpp
+++ b/main.cpp
@@ -90,7 +90,7 @@
     {
         std::fprintf(stderr, "*dataLen too small: %u\n",
                      static_cast<uint32_t>(reqLength));
-        return IPMI_CC_INVALID;
+        return IPMI_CC_REQ_DATA_LEN_INVALID;
     }
 
     // using struct prefix due to nature as c-style pod struct.
@@ -102,7 +102,7 @@
     {
         std::fprintf(stderr, "*dataLen too small: %u\n",
                      static_cast<uint32_t>(reqLength));
-        return IPMI_CC_INVALID;
+        return IPMI_CC_REQ_DATA_LEN_INVALID;
     }
 
     // Check the statistic to see if we recognize it.
@@ -133,7 +133,7 @@
     if (name.find("/") != std::string::npos)
     {
         std::fprintf(stderr, "Invalid or illegal name: '%s'\n", name.c_str());
-        return IPMI_CC_INVALID;
+        return IPMI_CC_INVALID_FIELD_REQUEST;
     }
 
     // TODO: Transition to using the netlink api.
@@ -145,7 +145,7 @@
     if (!fs::exists(path, ec))
     {
         std::fprintf(stderr, "Path: '%s' doesn't exist.\n", path.c_str());
-        return IPMI_CC_INVALID;
+        return IPMI_CC_INVALID_FIELD_REQUEST;
     }
     // We're uninterested in the state of ec.
 
@@ -163,7 +163,7 @@
     }
     catch (std::ios_base::failure& fail)
     {
-        return IPMI_CC_INVALID;
+        return IPMI_CC_UNSPECIFIED_ERROR;
     }
 
     struct EthStatReply reply;