Add exception when constructor fails

We should fail as soon as we know the object had failed to init the
cryptdevice correctly. There is no logic to compensate this type of
failure.

Signed-off-by: John Edward Broadbent <jebr@google.com>
Change-Id: I4c4b3719840ef42d8ecf378410ff0788fb040b1a
diff --git a/include/cryptsetupInterface.hpp b/include/cryptsetupInterface.hpp
index 719e98b..0fb0c32 100644
--- a/include/cryptsetupInterface.hpp
+++ b/include/cryptsetupInterface.hpp
@@ -250,7 +250,9 @@
         int retval = crypt_init(&cryptDev, device);
         if (retval < 0)
         {
-            return nullptr;
+            lg2::error("Failed to crypt_init", "REDFISH_MESSAGE_ID",
+                       std::string("OpenBMC.0.1.InitFail"));
+            throw ResourceNotFound();
         }
 
         return cryptDev;