continue loading libraries if factory excepts

If one of the blob handler factories throws an exception, it would stop
processing.  If the first one it tried failed, then none would load.
This changes that behavior such that such errors are logged.  If a
platform is using a blob handler for firmware updates and the firmware
update breaks the ability for future updates by breaking a library that
loads before it, that is now avoided.

Tested: Ran on qemu with broken blob handler factory and before no blobs
were listed, and now all the other blobs were listed.

Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: Ief2999a200708cfab0442aacb5a9056f3aa07260
diff --git a/utils.cpp b/utils.cpp
index e03ec90..d3e2d67 100644
--- a/utils.cpp
+++ b/utils.cpp
@@ -69,15 +69,24 @@
             continue;
         }
 
-        std::unique_ptr<GenericBlobInterface> result = factory();
-        if (!result)
+        try
         {
-            log<level::ERR>("Unable to create handler",
-                            entry("HANDLER=%s", p.c_str()));
-            continue;
-        }
+            std::unique_ptr<GenericBlobInterface> result = factory();
+            if (!result)
+            {
+                log<level::ERR>("Unable to create handler",
+                                entry("HANDLER=%s", p.c_str()));
+                continue;
+            }
 
-        manager->registerHandler(std::move(result));
+            manager->registerHandler(std::move(result));
+        }
+        catch (const std::exception& e)
+        {
+            log<level::ERR>("Received exception loading handler",
+                            entry("HANDLER=%s", p.c_str()),
+                            entry("EXCEPTION=%s", e.what()));
+        }
     }
 }