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: I7f517d094245e8e1a6169f43582522889bb895d0
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/cpld.cpp b/cpld.cpp
index 3a65674..ad874b2 100644
--- a/cpld.cpp
+++ b/cpld.cpp
@@ -56,7 +56,7 @@
{
std::fprintf(stderr, "Invalid command length: %u\n",
static_cast<uint32_t>(*dataLen));
- return IPMI_CC_INVALID;
+ return IPMI_CC_REQ_DATA_LEN_INVALID;
}
// reqBuf[0] is the subcommand.
@@ -77,7 +77,7 @@
{
std::fprintf(stderr, "Path: '%s' doesn't exist.\n",
opath.str().c_str());
- return IPMI_CC_INVALID;
+ return IPMI_CC_INVALID_FIELD_REQUEST;
}
// We're uninterested in the state of ec.
@@ -92,7 +92,7 @@
}
catch (std::ios_base::failure& fail)
{
- return IPMI_CC_INVALID;
+ return IPMI_CC_UNSPECIFIED_ERROR;
}
// If value parses as expected, return version.
@@ -106,7 +106,7 @@
if (num_fields == 0)
{
std::fprintf(stderr, "Invalid version.\n");
- return IPMI_CC_INVALID;
+ return IPMI_CC_UNSPECIFIED_ERROR;
}
// Truncate if the version is too high (documented).