Skip to content

Commit c1f5598

Browse files
committed
Increase error message granularity in Memory Mapped File
1 parent fa26c28 commit c1f5598

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/MemoryMappedFile.cxx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,20 @@ MemoryMappedFile::MemoryMappedFile(const std::string& fileName, size_t fileSize,
3838
mInternal->fileName = fileName;
3939
mInternal->deleteFileOnDestruction = deleteFileOnDestruction;
4040

41-
// Try to acquire the lock on the file
4241
if (lockMap) {
42+
// Try to acquire the lock on the file
4343
try{
4444
Utilities::resetSmartPtr(mInterprocessLock, "Alice_O2_RoC_MMF_" + fileName + "_lock");
45-
mMapAcquired = map(fileName, fileSize);
46-
}
47-
catch (const boost::exception& e) {
45+
} catch (const boost::exception& e) {
4846
BOOST_THROW_EXCEPTION(LockException()
49-
<< ErrorInfo::Message("Memory map file is locked by another process."));
47+
<< ErrorInfo::Message("Couldn't lock Memory Mapped File; " + boost::diagnostic_information(e)));
48+
}
49+
50+
try {
51+
mMapAcquired = map(fileName, fileSize);
52+
} catch (const boost::exception& e) {
53+
BOOST_THROW_EXCEPTION(MemoryMapException()
54+
<< ErrorInfo::Message(boost::diagnostic_information(e)));
5055
}
5156
}
5257
}

0 commit comments

Comments
 (0)