Fix Bad VPD Handling

This commit fixes two issues discovered with handling VPD that
cannot be parsed:

* If a parser object cannot be identified, return a VPDDataException
  and not a runtime_error.
* Fix a code bug which was causing us to run the parser twice.

Tested: Tested agsinst bad VPD data and verified that the right exception
is now thrown.

Signed-off-by: Santosh Puranik <santosh.puranik@in.ibm.com>
Change-Id: I5ed10519b26f16b69b4b8b3f8a6f1f4ef2fa3cdb
diff --git a/ibm_vpd_app.cpp b/ibm_vpd_app.cpp
index e3e6322..47ad4fc 100644
--- a/ibm_vpd_app.cpp
+++ b/ibm_vpd_app.cpp
@@ -990,12 +990,6 @@
             }
         }
 
-        Binary vpdVector = getVpdDataInVector(js, file);
-        ParserInterface* parser = ParserFactory::getParser(move(vpdVector));
-
-        variant<KeywordVpdMap, Store> parseResult;
-        parseResult = parser->parse();
-
         try
         {
             Binary vpdVector = getVpdDataInVector(js, file);
diff --git a/vpd-parser/parser_factory.cpp b/vpd-parser/parser_factory.cpp
index e31d669..7953655 100644
--- a/vpd-parser/parser_factory.cpp
+++ b/vpd-parser/parser_factory.cpp
@@ -4,11 +4,13 @@
 #include "keyword_vpd_parser.hpp"
 #include "memory_vpd_parser.hpp"
 #include "utils.hpp"
+#include "vpd_exceptions.hpp"
 
 using namespace vpd::keyword::parser;
 using namespace openpower::vpd::memory::parser;
 using namespace openpower::vpd::parser::interface;
 using namespace openpower::vpd::ipz::parser;
+using namespace openpower::vpd::exceptions;
 
 namespace openpower
 {
@@ -40,7 +42,7 @@
         }
 
         default:
-            throw std::runtime_error("Invalid VPD format");
+            throw VpdDataException("Unable to determine VPD format");
     }
 }