diff --git a/include/storage/shared_monitor.hpp b/include/storage/shared_monitor.hpp index 2084112d4..9847b1690 100644 --- a/include/storage/shared_monitor.hpp +++ b/include/storage/shared_monitor.hpp @@ -42,7 +42,16 @@ template struct SharedMonitor SharedMonitor(const Data &initial_data) { - shmem = bi::shared_memory_object(bi::open_or_create, Data::name, bi::read_write); + try + { + shmem = bi::shared_memory_object(bi::open_or_create, Data::name, bi::read_write); + } + catch (const bi::interprocess_exception &exception) + { + auto message = boost::format("could not create directory or file '%1%' \n") % + exception.what(); + throw util::exception(message.str() + SOURCE_REF); + } bi::offset_t size = 0; if (shmem.get_size(size) && size == 0) @@ -126,7 +135,9 @@ template struct SharedMonitor } catch (const bi::interprocess_exception &exception) { - return false; + auto message = boost::format("could not create directory or file '%1%' \n") % + exception.what(); + throw util::exception(message.str() + SOURCE_REF); } return true; }