Reduce journal logs

Presently the code was creating the elog during reading of
the values from the config parser which creates
the journal log internally("Internal error Occured")

Apart from creating elog,Code also logs into the journal
more descriptive message saying which section and key
was not found.

The code which catches the exception that also logs
into the journal.

In the changed approach instead of throwing exception
we are returning the return code as not finding a section
or key in the network config file is not an error.

Change-Id: Ib89a3af6541fdf93fb5fa9a8e583d6c6ed88da79
Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
diff --git a/test/test_config_parser.cpp b/test/test_config_parser.cpp
index a07390b..1c902d2 100644
--- a/test/test_config_parser.cpp
+++ b/test/test_config_parser.cpp
@@ -46,17 +46,20 @@
 
 TEST_F(TestConfigParser, ReadConfigDataFromFile)
 {
-    auto values = parser.getValues("Network", "DHCP");
+    config::ReturnCode rc = config::ReturnCode::SUCCESS;
+    config::ValueList values;
+
+    std::tie(rc, values) = parser.getValues("Network", "DHCP");
     std::string expectedValue = "true";
     bool found = isValueFound(values, expectedValue);
     EXPECT_EQ(found, true);
 
-    values = parser.getValues("DHCP", "ClientIdentifier");
+    std::tie(rc, values) = parser.getValues("DHCP", "ClientIdentifier");
     expectedValue = "mac";
     found = isValueFound(values, expectedValue);
     EXPECT_EQ(found, true);
 
-    values = parser.getValues("Match", "Name");
+    std::tie(rc, values) = parser.getValues("Match", "Name");
     expectedValue = "eth0";
     found = isValueFound(values, expectedValue);
     EXPECT_EQ(found, true);
@@ -64,35 +67,20 @@
 
 TEST_F(TestConfigParser, SectionNotExist)
 {
-    using namespace sdbusplus::xyz::openbmc_project::Common::Error;
-    bool caughtException = false;
-    try
-    {
-        parser.getValues("abc", "ipaddress");
-    }
-    catch (const std::exception& e)
-    {
-        caughtException = true;
-    }
-    EXPECT_EQ(true, caughtException);
+    config::ReturnCode rc = config::ReturnCode::SUCCESS;
+    config::ValueList values;
+    std::tie(rc, values) = parser.getValues("abc", "ipaddress");
+    EXPECT_EQ(config::ReturnCode::SECTION_NOT_FOUND, rc);
 }
 
 TEST_F(TestConfigParser, KeyNotFound)
 {
-    using namespace sdbusplus::xyz::openbmc_project::Common::Error;
-    bool caughtException = false;
-    try
-    {
-        parser.getValues("Network", "abc");
-    }
-    catch (const std::exception& e)
-    {
-        caughtException = true;
-    }
-    EXPECT_EQ(true, caughtException);
+    config::ReturnCode rc = config::ReturnCode::SUCCESS;
+    config::ValueList values;
+    std::tie(rc, values) = parser.getValues("Network", "abc");
+    EXPECT_EQ(config::ReturnCode::KEY_NOT_FOUND, rc);
     remove("/tmp/eth0.network");
 }
 
 }//namespace network
 }//namespace phosphor
-