@@ -146,23 +146,38 @@ void Worker::performInitialSetup()
146
146
// some reason at system power on.
147
147
return ;
148
148
}
149
- catch (const std::exception& ex )
149
+ catch (const std::exception& l_ex )
150
150
{
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)))
152
159
{
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 = " ;
154
163
}
155
- else if (typeid (ex ) == std::type_index (typeid (EccException)))
164
+ else if (typeid (l_ex ) == std::type_index (typeid (EccException)))
156
165
{
157
- // TODO:Catch logic to be implemented once PEL code goes in.
166
+ l_errType = types::ErrorType::EccCheckFailed;
167
+ l_errMsg =
168
+ " ECC Exception occurred for system VPD file path with error = " ;
158
169
}
159
- else if (typeid (ex ) == std::type_index (typeid (JsonException)))
170
+ else if (typeid (l_ex ) == std::type_index (typeid (JsonException)))
160
171
{
161
- // TODO:Catch logic to be implemented once PEL code goes in.
172
+ l_errType = types::ErrorType::JsonFailure;
173
+ l_errMsg =
174
+ " Json Exception occurred for system VPD file path with error = " +
175
+ ;
162
176
}
163
177
164
- logging::logMessage (ex.what ());
165
- throw ;
178
+ EventLogger::createSyncPel (l_errType, l_sevType, __FILE__, __FUNCTION__,
179
+ 0 , l_errMsg + l_ex.what (), std::nullopt ,
180
+ std::nullopt , std::nullopt , std::nullopt );
166
181
}
167
182
}
168
183
#endif
@@ -302,57 +317,9 @@ void Worker::fillVPDMap(const std::string& vpdFilePath,
302
317
throw std::runtime_error (" Can't Find physical file" );
303
318
}
304
319
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
- }
320
+ std::shared_ptr<Parser> vpdParser = std::make_shared<Parser>(vpdFilePath,
321
+ m_parsedJson);
322
+ vpdMap = vpdParser->parse ();
356
323
}
357
324
358
325
void Worker::getSystemJson (std::string& systemJson,
@@ -480,9 +447,9 @@ void Worker::setDeviceTreeAndJson()
480
447
// Implies it is default JSON.
481
448
std::string systemJson{JSON_ABSOLUTE_PATH_PREFIX};
482
449
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.
450
+ // ToDo: Need to check if INVENTORY_JSON_SYM_LINK pointing to correct
451
+ // system This is required to support movement from rainier to Blue
452
+ // Ridge on the fly.
486
453
487
454
// Do we have the entry for device tree in parsed JSON?
488
455
if (m_parsedJson.find (" devTree" ) == m_parsedJson.end ())
0 commit comments