fault-monitor: remove locally generated errors

Switch fault-monitor to use Common.Errors instead of locally defined
ones.  This greatly simplifies the build structure and follows the
expected phosphor-logging patterns better.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Idb3473989c86b3a505f3c0a238735db6f3a4349e
diff --git a/fault-monitor/fru-fault-monitor.cpp b/fault-monitor/fru-fault-monitor.cpp
index fb4f891..a390cbe 100644
--- a/fault-monitor/fru-fault-monitor.cpp
+++ b/fault-monitor/fru-fault-monitor.cpp
@@ -1,12 +1,10 @@
 #include "fru-fault-monitor.hpp"
 
-#include "elog-errors.hpp"
-
+#include <phosphor-logging/elog-errors.hpp>
 #include <phosphor-logging/elog.hpp>
 #include <phosphor-logging/lg2.hpp>
 #include <sdbusplus/exception.hpp>
-#include <xyz/openbmc_project/Led/Fru/Monitor/error.hpp>
-#include <xyz/openbmc_project/Led/Mapper/error.hpp>
+#include <xyz/openbmc_project/Common/error.hpp>
 
 namespace phosphor
 {
@@ -43,12 +41,10 @@
 using Interfaces = std::vector<Interface>;
 using MapperResponseType = std::map<Path, std::map<Service, Interfaces>>;
 
-using MethodErr =
-    sdbusplus::xyz::openbmc_project::Led::Mapper::Error::MethodError;
-using ObjectNotFoundErr =
-    sdbusplus::xyz::openbmc_project::Led::Mapper::Error::ObjectNotFoundError;
-using InventoryPathErr = sdbusplus::xyz::openbmc_project::Led::Fru::Monitor::
-    Error::InventoryPathError;
+using ResourceNotFoundErr =
+    sdbusplus::xyz::openbmc_project::Common::Error::ResourceNotFound;
+using InvalidArgumentErr =
+    sdbusplus::xyz::openbmc_project::Common::Error::InvalidArgument;
 
 std::string getService(sdbusplus::bus::bus& bus, const std::string& path)
 {
@@ -67,17 +63,13 @@
         lg2::error(
             "Failed to parse getService mapper response, ERROR = {ERROR}",
             "ERROR", e);
-        using namespace xyz::openbmc_project::Led::Mapper;
-        elog<ObjectNotFoundErr>(ObjectNotFoundError::METHOD_NAME("GetObject"),
-                                ObjectNotFoundError::PATH(path.c_str()),
-                                ObjectNotFoundError::INTERFACE(OBJMGR_IFACE));
+        using namespace xyz::openbmc_project::Common;
+        elog<ResourceNotFoundErr>(ResourceNotFound::RESOURCE(path.c_str()));
     }
     if (mapperResponse.empty())
     {
-        using namespace xyz::openbmc_project::Led::Mapper;
-        elog<ObjectNotFoundErr>(ObjectNotFoundError::METHOD_NAME("GetObject"),
-                                ObjectNotFoundError::PATH(path.c_str()),
-                                ObjectNotFoundError::INTERFACE(OBJMGR_IFACE));
+        using namespace xyz::openbmc_project::Common;
+        elog<ResourceNotFoundErr>(ResourceNotFound::RESOURCE(path.c_str()));
         return {};
     }
 
@@ -93,22 +85,19 @@
         groups.pop_back();
         service = getService(bus, groups);
     }
-    catch (const MethodErr& e)
+    catch (const ResourceNotFoundErr& e)
     {
-        commit<MethodErr>();
-        return;
-    }
-    catch (const ObjectNotFoundErr& e)
-    {
-        commit<ObjectNotFoundErr>();
+        commit<ResourceNotFoundErr>();
         return;
     }
 
     auto pos = path.rfind("/");
     if (pos == std::string::npos)
     {
-        using namespace xyz::openbmc_project::Led::Fru::Monitor;
-        report<InventoryPathErr>(InventoryPathError::PATH(path.c_str()));
+        using namespace xyz::openbmc_project::Common;
+        report<InvalidArgumentErr>(
+            InvalidArgument::ARGUMENT_NAME("path"),
+            InvalidArgument::ARGUMENT_VALUE(path.c_str()));
         return;
     }
     auto unit = path.substr(pos + 1);
diff --git a/fault-monitor/meson.build b/fault-monitor/meson.build
index 254a218..39ec458 100644
--- a/fault-monitor/meson.build
+++ b/fault-monitor/meson.build
@@ -1,5 +1,4 @@
 fault_monitor_sources = [
-    generated_sources,
     'monitor-main.cpp',
 ]
 
@@ -17,7 +16,7 @@
 executable(
     'phosphor-fru-fault-monitor',
     fault_monitor_sources,
-    include_directories: ['.', '../', '../gen'],
+    include_directories: ['.', '../'],
     dependencies: deps,
     install: true,
     install_dir: get_option('bindir')