diff options
| author | Dan Engelbrecht <[email protected]> | 2023-04-26 16:27:49 +0200 |
|---|---|---|
| committer | Dan Engelbrecht <[email protected]> | 2023-04-26 16:27:49 +0200 |
| commit | 1807f582675844c17aa75cdd79d3092c883af809 (patch) | |
| tree | 8ee8f4e9bd599f0f38534a4784c6d3360ef4abb5 /zencore/iobuffer.cpp | |
| parent | make sure we pick up the error code before it is cleared when throwing error (diff) | |
| download | zen-1807f582675844c17aa75cdd79d3092c883af809.tar.xz zen-1807f582675844c17aa75cdd79d3092c883af809.zip | |
log error before throwing exception so we can see the callstack
Diffstat (limited to 'zencore/iobuffer.cpp')
| -rw-r--r-- | zencore/iobuffer.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/zencore/iobuffer.cpp b/zencore/iobuffer.cpp index d037d7a85..1d7d47695 100644 --- a/zencore/iobuffer.cpp +++ b/zencore/iobuffer.cpp @@ -324,7 +324,9 @@ IoBufferExtendedCore::Materialize() const if (NewMmapHandle == nullptr) { - throw std::system_error(std::error_code(::GetLastError(), std::system_category()), + int32_t Error = zen::GetLastError(); + ZEN_ERROR("CreateFileMapping failed on file '{}', {}", zen::PathFromHandle(m_FileHandle), GetSystemErrorAsString(Error)); + throw std::system_error(std::error_code(Error, std::system_category()), fmt::format("CreateFileMapping failed on file '{}'", zen::PathFromHandle(m_FileHandle))); } @@ -354,6 +356,11 @@ IoBufferExtendedCore::Materialize() const #if ZEN_PLATFORM_WINDOWS CloseHandle(NewMmapHandle); #endif // ZEN_PLATFORM_WINDOWS + ZEN_ERROR("MapViewOfFile failed (offset {:#x}, size {:#x}) file: '{}', {}", + MapOffset, + MapSize, + zen::PathFromHandle(m_FileHandle), + GetSystemErrorAsString(Error)); throw std::system_error(std::error_code(Error, std::system_category()), fmt::format("MapViewOfFile failed (offset {:#x}, size {:#x}) file: '{}'", MapOffset, |