exception messages from Boost
This commit is contained in:
parent
41dda32546
commit
123b6f058f
@ -42,7 +42,16 @@ template <typename Data> struct SharedMonitor
|
|||||||
|
|
||||||
SharedMonitor(const Data &initial_data)
|
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;
|
bi::offset_t size = 0;
|
||||||
if (shmem.get_size(size) && size == 0)
|
if (shmem.get_size(size) && size == 0)
|
||||||
@ -126,7 +135,9 @@ template <typename Data> struct SharedMonitor
|
|||||||
}
|
}
|
||||||
catch (const bi::interprocess_exception &exception)
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user