Skip to content

Commit 5028d9d

Browse files
Merge pull request #526 from RekhaAparna01/pelForManager_main
Enable PEL for manager_main
2 parents 6b1bdfc + 5da5cab commit 5028d9d

File tree

1 file changed

+44
-2
lines changed

1 file changed

+44
-2
lines changed

vpd-manager/src/manager_main.cpp

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
#include "config.h"
22

33
#include "bios_handler.hpp"
4+
#include "event_logger.hpp"
5+
#include "exceptions.hpp"
46
#include "logger.hpp"
57
#include "manager.hpp"
8+
#include "types.hpp"
69

710
#include <sdbusplus/asio/connection.hpp>
811
#include <sdbusplus/asio/object_server.hpp>
@@ -44,9 +47,48 @@ int main(int, char**)
4447

4548
exit(EXIT_SUCCESS);
4649
}
47-
catch (const std::exception& e)
50+
catch (const std::exception& l_ex)
4851
{
49-
std::cerr << e.what() << std::endl;
52+
if (typeid(l_ex) == typeid(vpd::JsonException))
53+
{
54+
// ToDo: Severity needs to be revisited.
55+
vpd::EventLogger::createAsyncPel(
56+
vpd::types::ErrorType::JsonFailure,
57+
vpd::types::SeverityType::Informational, __FILE__, __FUNCTION__,
58+
0,
59+
std::string("VPD Manager service failed with : ") + l_ex.what(),
60+
std::nullopt, std::nullopt, std::nullopt, std::nullopt);
61+
}
62+
else if (typeid(l_ex) == typeid(vpd::GpioException))
63+
{
64+
// ToDo: Severity needs to be revisited.
65+
vpd::EventLogger::createAsyncPel(
66+
vpd::types::ErrorType::GpioError,
67+
vpd::types::SeverityType::Informational, __FILE__, __FUNCTION__,
68+
0,
69+
std::string("VPD Manager service failed with : ") + l_ex.what(),
70+
std::nullopt, std::nullopt, std::nullopt, std::nullopt);
71+
}
72+
else if (typeid(l_ex) == typeid(sdbusplus::exception::SdBusError))
73+
{
74+
// ToDo: Severity needs to be revisited.
75+
vpd::EventLogger::createAsyncPel(
76+
vpd::types::ErrorType::DbusFailure,
77+
vpd::types::SeverityType::Informational, __FILE__, __FUNCTION__,
78+
0,
79+
std::string("VPD Manager service failed with : ") + l_ex.what(),
80+
std::nullopt, std::nullopt, std::nullopt, std::nullopt);
81+
}
82+
else
83+
{
84+
// ToDo: Severity needs to be revisited.
85+
vpd::EventLogger::createAsyncPel(
86+
vpd::types::ErrorType::InvalidVpdMessage,
87+
vpd::types::SeverityType::Informational, __FILE__, __FUNCTION__,
88+
0,
89+
std::string("VPD Manager service failed with : ") + l_ex.what(),
90+
"BMC0001", std::nullopt, std::nullopt, std::nullopt);
91+
}
5092
}
5193
exit(EXIT_FAILURE);
5294
}

0 commit comments

Comments
 (0)