|
1 | 1 | #include "config.h" |
2 | 2 |
|
3 | 3 | #include "bios_handler.hpp" |
| 4 | +#include "event_logger.hpp" |
| 5 | +#include "exceptions.hpp" |
4 | 6 | #include "logger.hpp" |
5 | 7 | #include "manager.hpp" |
| 8 | +#include "types.hpp" |
6 | 9 |
|
7 | 10 | #include <sdbusplus/asio/connection.hpp> |
8 | 11 | #include <sdbusplus/asio/object_server.hpp> |
@@ -44,9 +47,48 @@ int main(int, char**) |
44 | 47 |
|
45 | 48 | exit(EXIT_SUCCESS); |
46 | 49 | } |
47 | | - catch (const std::exception& e) |
| 50 | + catch (const std::exception& l_ex) |
48 | 51 | { |
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 | + } |
50 | 92 | } |
51 | 93 | exit(EXIT_FAILURE); |
52 | 94 | } |
0 commit comments