@@ -146,23 +146,40 @@ void Worker::performInitialSetup()
146146 // some reason at system power on.
147147 return ;
148148 }
149- catch (const std::exception& ex )
149+ catch (const std::exception& l_ex )
150150 {
151- if (typeid (ex) == std::type_index (typeid (DataException)))
151+ // Any issue is system inital set up is handled in this catch. Service
152+ // is not blocked for these errors.
153+
154+ types::ErrorType l_errType = types::ErrorType::InvalidSystem;
155+ types::SeverityType l_sevType = types::SeverityType::Critical;
156+ std::string l_errMsg;
157+
158+ if (typeid (l_ex) == std::type_index (typeid (DataException)))
152159 {
153- // TODO:Catch logic to be implemented once PEL code goes in.
160+ l_errType = types::ErrorType::InvalidVpdMessage;
161+ l_errMsg =
162+ (" Data Exception occurred for system VPD file path with error = " +
163+ l_ex.what ());
154164 }
155- else if (typeid (ex ) == std::type_index (typeid (EccException)))
165+ else if (typeid (l_ex ) == std::type_index (typeid (EccException)))
156166 {
157- // TODO:Catch logic to be implemented once PEL code goes in.
167+ l_errType = types::ErrorType::EccCheckFailed;
168+ l_errMsg =
169+ (" ECC Exception occurred for system VPD file path with error = " +
170+ l_ex.what ());
158171 }
159- else if (typeid (ex ) == std::type_index (typeid (JsonException)))
172+ else if (typeid (l_ex ) == std::type_index (typeid (JsonException)))
160173 {
161- // TODO:Catch logic to be implemented once PEL code goes in.
174+ l_errType = types::ErrorType::JsonFailure;
175+ l_errMsg =
176+ (" Json Exception occurred for system VPD file path with error = " +
177+ l_ex.what ());
162178 }
163179
164- logging::logMessage (ex.what ());
165- throw ;
180+ EventLogger::createSyncPel (l_errType, l_sevType, __FILE__, __FUNCTION__,
181+ 0 , l_errMsg, std::nullopt , std::nullopt ,
182+ std::nullopt , std::nullopt );
166183 }
167184}
168185#endif
@@ -302,57 +319,9 @@ void Worker::fillVPDMap(const std::string& vpdFilePath,
302319 throw std::runtime_error (" Can't Find physical file" );
303320 }
304321
305- try
306- {
307- std::shared_ptr<Parser> vpdParser =
308- std::make_shared<Parser>(vpdFilePath, m_parsedJson);
309- vpdMap = vpdParser->parse ();
310- }
311- catch (const std::exception& ex)
312- {
313- if (typeid (ex) == std::type_index (typeid (DataException)))
314- {
315- // TODO: Do what needs to be done in case of Data exception.
316- // Uncomment when PEL implementation goes in.
317- /* string errorMsg =
318- "VPD file is either empty or invalid. Parser failed for [";
319- errorMsg += m_vpdFilePath;
320- errorMsg += "], with error = " + std::string(ex.what());
321-
322- additionalData.emplace("DESCRIPTION", errorMsg);
323- additionalData.emplace("CALLOUT_INVENTORY_PATH",
324- INVENTORY_PATH + baseFruInventoryPath);
325- createPEL(additionalData, pelSeverity, errIntfForInvalidVPD,
326- nullptr);*/
327-
328- // throw generic error from here to inform main caller about
329- // failure.
330- logging::logMessage (ex.what ());
331- throw std::runtime_error (
332- " Data Exception occurred for file path = " + vpdFilePath);
333- }
334-
335- if (typeid (ex) == std::type_index (typeid (EccException)))
336- {
337- // TODO: Do what needs to be done in case of ECC exception.
338- // Uncomment when PEL implementation goes in.
339- /* additionalData.emplace("DESCRIPTION", "ECC check failed");
340- additionalData.emplace("CALLOUT_INVENTORY_PATH",
341- INVENTORY_PATH + baseFruInventoryPath);
342- createPEL(additionalData, pelSeverity, errIntfForEccCheckFail,
343- nullptr);
344- */
345-
346- logging::logMessage (ex.what ());
347- // Need to decide once all error handling is implemented.
348- // vpdSpecificUtility::dumpBadVpd(vpdFilePath,vpdVector);
349-
350- // throw generic error from here to inform main caller about
351- // failure.
352- throw std::runtime_error (" Ecc Exception occurred for file path = " +
353- vpdFilePath);
354- }
355- }
322+ std::shared_ptr<Parser> vpdParser = std::make_shared<Parser>(vpdFilePath,
323+ m_parsedJson);
324+ vpdMap = vpdParser->parse ();
356325}
357326
358327void Worker::getSystemJson (std::string& systemJson,
@@ -480,9 +449,9 @@ void Worker::setDeviceTreeAndJson()
480449 // Implies it is default JSON.
481450 std::string systemJson{JSON_ABSOLUTE_PATH_PREFIX};
482451
483- // ToDo: Need to check if INVENTORY_JSON_SYM_LINK pointing to correct system
484- // This is required to support movement from rainier to Blue Ridge on the
485- // fly.
452+ // ToDo: Need to check if INVENTORY_JSON_SYM_LINK pointing to correct
453+ // system This is required to support movement from rainier to Blue
454+ // Ridge on the fly.
486455
487456 // Do we have the entry for device tree in parsed JSON?
488457 if (m_parsedJson.find (" devTree" ) == m_parsedJson.end ())
0 commit comments