Improve error handling for exceptions and asserts

The phosphor-psu-code-manager application currently exits abnormally due
to the following conditions:
* Uncaught exception
* False assert() statement

An abnormal exit can result in a core dump and/or a BMC dump. It also
causes the service to be restarted. If the failure condition remains,
the restarts will fail repeatedly, and systemd will stop trying to start
the service.

Improve error handling for exceptions in the following ways:
* Add try/catch blocks to the following locations:
  * Code that calls functions that throw and needs to handle exceptions.
    * For example, code looping over PSU objects may need to handle an
      exception for one PSU and then continue to the remaining PSUs.
  * D-Bus PropertiesChanged and InterfacesAdded event handlers.
    * Do not allow exceptions to escape to the sdbusplus stack frames.
  * main()
    * Last line of defense; catching avoids a core dump.
* Write exception error message to the journal if appropriate

Replace assert statements with exceptions or error messages to the
journal.

Tested:
* Tested all modified functions/methods.
* Verified that all exceptions were caught and logged to the journal if
  appropriate.
* Verified that asserts were replaced by exceptions and logging.
* See complete test plan at
  https://gist.github.com/smccarney/b4bf568639fedd269c9737234fa2803d

Change-Id: I933386e94f43a915b301d6aef7d91691816a0548
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
diff --git a/test/test_item_updater.cpp b/test/test_item_updater.cpp
index 7523bfc..02a8409 100644
--- a/test/test_item_updater.cpp
+++ b/test/test_item_updater.cpp
@@ -478,7 +478,7 @@
     // The valid image in test/psu-images-one-valid-one-invalid/model-1/
     auto objPathValid = getObjPath("psu-test.v0.4");
     auto objPathInvalid = getObjPath("psu-test.v0.5");
-    // activation and version object will be added on scan dir
+    // No activation or version objects will be added on scan dir
     EXPECT_CALL(sdbusMock, sd_bus_emit_object_added(_, StrEq(objPathValid)))
         .Times(0);
     EXPECT_CALL(sdbusMock, sd_bus_emit_object_added(_, StrEq(objPathInvalid)))
@@ -502,7 +502,7 @@
                                              _, StrEq(PRESENT)))
         .WillOnce(Return(any(PropertyType(true)))); // present
     EXPECT_CALL(mockedUtils, getModel(StrEq(psuPath)))
-        .WillOnce(Return(std::string("dummyModel")));
+        .WillOnce(Return(std::string("model-3")));
 
     // The item updater itself
     EXPECT_CALL(sdbusMock, sd_bus_emit_object_added(_, StrEq(dBusPath)))
@@ -522,7 +522,7 @@
                                _, StrEq(objPath),
                                StrEq("xyz.openbmc_project.Common.FilePath"),
                                Pointee(StrEq("Path"))))
-        .Times(0);
+        .Times(1);
     scanDirectory("./psu-images-valid-version0");
 }