Replace error strings with logging errors in device operations

Change-Id: I0fc1c23e51a0233c18775ee712132dba7e4c7d7e
Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
diff --git a/proc_control.cpp b/proc_control.cpp
index 10c3ffa..a86b354 100644
--- a/proc_control.cpp
+++ b/proc_control.cpp
@@ -17,7 +17,9 @@
 #include <functional>
 #include <iostream>
 #include <phosphor-logging/log.hpp>
+#include <phosphor-logging/elog.hpp>
 #include "registration.hpp"
+#include "elog-errors.hpp"
 
 using namespace openpower::util;
 
@@ -34,6 +36,7 @@
 
 int main(int argc, char** argv)
 {
+    using namespace phosphor::logging;
     const ProcedureMap& procedures = Registration::getProcedures();
 
     if (argc != 2)
@@ -56,10 +59,24 @@
     {
         procedure->second();
     }
-    catch (std::exception& e)
+    catch (org::open_power::Proc::CFAM::SeekFailure& e)
     {
-        //TODO: commit an actual error that does a callout
-        phosphor::logging::log<phosphor::logging::level::ERR>(e.what());
+        commit<org::open_power::Proc::CFAM::SeekFailure>();
+        return -1;
+    }
+    catch (org::open_power::Proc::CFAM::OpenFailure& e)
+    {
+        commit<org::open_power::Proc::CFAM::OpenFailure>();
+        return -1;
+    }
+    catch (org::open_power::Proc::CFAM::WriteFailure& e)
+    {
+        commit<org::open_power::Proc::CFAM::WriteFailure>();
+        return -1;
+    }
+    catch (org::open_power::Proc::CFAM::ReadFailure& e)
+    {
+        commit<org::open_power::Proc::CFAM::ReadFailure>();
         return -1;
     }