aboutsummaryrefslogtreecommitdiff
path: root/src/zencore/iobuffer.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2023-05-09 17:19:57 +0200
committerGitHub <[email protected]>2023-05-09 17:19:57 +0200
commit835f14403d5f6e04d65b761857ee1271a4e7fe98 (patch)
tree4a5b69325e7b468e1fdabc2bfd296f4e0b647175 /src/zencore/iobuffer.cpp
parentfixed merge error (diff)
downloadzen-835f14403d5f6e04d65b761857ee1271a4e7fe98.tar.xz
zen-835f14403d5f6e04d65b761857ee1271a4e7fe98.zip
add context to MapViewOfFile errors (#282)
* added FileSizeFromHandle function * added file size to error message when MapViewOfFile fails
Diffstat (limited to 'src/zencore/iobuffer.cpp')
-rw-r--r--src/zencore/iobuffer.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/zencore/iobuffer.cpp b/src/zencore/iobuffer.cpp
index 1d7d47695..e28bf11b2 100644
--- a/src/zencore/iobuffer.cpp
+++ b/src/zencore/iobuffer.cpp
@@ -356,16 +356,19 @@ IoBufferExtendedCore::Materialize() const
#if ZEN_PLATFORM_WINDOWS
CloseHandle(NewMmapHandle);
#endif // ZEN_PLATFORM_WINDOWS
- ZEN_ERROR("MapViewOfFile failed (offset {:#x}, size {:#x}) file: '{}', {}",
+
+ ZEN_ERROR("MapViewOfFile failed (offset {:#x}, size {:#x}) file: '{}' (size {:#x}), {}",
MapOffset,
MapSize,
zen::PathFromHandle(m_FileHandle),
+ zen::FileSizeFromHandle(m_FileHandle),
GetSystemErrorAsString(Error));
throw std::system_error(std::error_code(Error, std::system_category()),
- fmt::format("MapViewOfFile failed (offset {:#x}, size {:#x}) file: '{}'",
+ fmt::format("MapViewOfFile failed (offset {:#x}, size {:#x}) file: '{}' (size {:#x})",
MapOffset,
MapSize,
- zen::PathFromHandle(m_FileHandle)));
+ zen::PathFromHandle(m_FileHandle),
+ zen::FileSizeFromHandle(m_FileHandle)));
}
m_MappedPointer = MappedBase;