Still report errors when metadata capture fails
In the very unlikely scenario that a PMBus command
fails while trying to collect error log metadata,
don't let the thrown exception break the code out
of creating the error log.
Change-Id: I3ca057cdc6656a8585f49ee2216f5ef13f134360
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/power-sequencer/ucd90160.cpp b/power-sequencer/ucd90160.cpp
index 7f098f7..53fff21 100644
--- a/power-sequencer/ucd90160.cpp
+++ b/power-sequencer/ucd90160.cpp
@@ -153,9 +153,17 @@
auto railName = railNames.at(page);
util::NamesValues nv;
- nv.add("STATUS_WORD", statusWord);
- nv.add("STATUS_VOUT", vout);
- nv.add("MFR_STATUS", readMFRStatus());
+ try
+ {
+ nv.add("STATUS_WORD", statusWord);
+ nv.add("STATUS_VOUT", vout);
+ nv.add("MFR_STATUS", readMFRStatus());
+ }
+ catch (device_error::ReadFailure& e)
+ {
+ log<level::ERR>("ReadFailure when collecting metadata");
+ commit<device_error::ReadFailure>();
+ }
using metadata = org::open_power::Witherspoon::Fault::
PowerSequencerVoltageFault;
@@ -245,9 +253,18 @@
auto status = (gpiStatus == Value::low) ? 0 : 1;
util::NamesValues nv;
- nv.add("STATUS_WORD", readStatusWord());
- nv.add("MFR_STATUS", readMFRStatus());
- nv.add("INPUT_STATUS", status);
+
+ try
+ {
+ nv.add("STATUS_WORD", readStatusWord());
+ nv.add("MFR_STATUS", readMFRStatus());
+ nv.add("INPUT_STATUS", status);
+ }
+ catch (device_error::ReadFailure& e)
+ {
+ log<level::ERR>("ReadFailure when collecting metadata");
+ commit<device_error::ReadFailure>();
+ }
using metadata = org::open_power::Witherspoon::Fault::
PowerSequencerPGOODFault;
@@ -268,8 +285,17 @@
void UCD90160::createPowerFaultLog()
{
util::NamesValues nv;
- nv.add("STATUS_WORD", readStatusWord());
- nv.add("MFR_STATUS", readMFRStatus());
+
+ try
+ {
+ nv.add("STATUS_WORD", readStatusWord());
+ nv.add("MFR_STATUS", readMFRStatus());
+ }
+ catch (device_error::ReadFailure& e)
+ {
+ log<level::ERR>("ReadFailure when collecting metadata");
+ commit<device_error::ReadFailure>();
+ }
using metadata = org::open_power::Witherspoon::Fault::
PowerSequencerFault;
@@ -420,8 +446,17 @@
void UCD90160::gpuPGOODError(const std::string& callout)
{
util::NamesValues nv;
- nv.add("STATUS_WORD", readStatusWord());
- nv.add("MFR_STATUS", readMFRStatus());
+
+ try
+ {
+ nv.add("STATUS_WORD", readStatusWord());
+ nv.add("MFR_STATUS", readMFRStatus());
+ }
+ catch (device_error::ReadFailure& e)
+ {
+ log<level::ERR>("ReadFailure when collecting metadata");
+ commit<device_error::ReadFailure>();
+ }
using metadata = org::open_power::Witherspoon::Fault::GPUPowerFault;
@@ -433,8 +468,17 @@
void UCD90160::gpuOverTempError(const std::string& callout)
{
util::NamesValues nv;
- nv.add("STATUS_WORD", readStatusWord());
- nv.add("MFR_STATUS", readMFRStatus());
+
+ try
+ {
+ nv.add("STATUS_WORD", readStatusWord());
+ nv.add("MFR_STATUS", readMFRStatus());
+ }
+ catch (device_error::ReadFailure& e)
+ {
+ log<level::ERR>("ReadFailure when collecting metadata");
+ commit<device_error::ReadFailure>();
+ }
using metadata = org::open_power::Witherspoon::Fault::GPUOverTemp;