Skip to content

Commit

Permalink
Add exception handling
Browse files Browse the repository at this point in the history
Signed-off-by: Jemale Lockett <jemale.lockett@intel.com>
  • Loading branch information
Jemale committed Sep 26, 2024
1 parent cad0645 commit d7bb75c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 7 additions & 2 deletions layer_tests/tracing/src/test_ltracing_ipc_event_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,13 @@ int main(int argc, char **argv) {

lzt::shared_ipc_event_data_t shared_data;
bipc::shared_memory_object shm;
shm = bipc::shared_memory_object(bipc::open_only, "ipc_ltracing_event_test",
bipc::read_write);
try {
shm = bipc::shared_memory_object(bipc::open_only, "ipc_ltracing_event_test",
bipc::read_write);
} catch (bipc::interprocess_exception &ex) {
LOG_DEBUG << "Child exit due to shared memory object open failure";
exit(EXIT_FAILURE);
}
shm.truncate(sizeof(lzt::shared_ipc_event_data_t));
bipc::mapped_region region(shm, bipc::read_only);
std::memcpy(&shared_data, region.get_address(),
Expand Down
4 changes: 4 additions & 0 deletions utils/logging/src/logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ void init_logging(const LoggingSettings settings) {
}

void init_logging(std::vector<std::string> &command_line) {
try {
init_logging(parse_command_line(command_line));
} catch (const po::error &e) {
std::cerr << "Error initializing logging parsing command line: " << e.what() << std::endl;
}
}

void stop_logging() {
Expand Down

0 comments on commit d7bb75c

Please sign in to comment.