aboutsummaryrefslogtreecommitdiff
path: root/zencore/iobuffer.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2023-04-26 16:21:36 +0200
committerDan Engelbrecht <[email protected]>2023-04-26 16:22:06 +0200
commit7ab93b7f7b4f9e3b9e5101c5f216fee7f3d6e68a (patch)
tree0e9f6540f7759f63342f6c22dc464d3771ee0084 /zencore/iobuffer.cpp
parentSafely handle missing blocks when doing garbage collection in block store dat... (diff)
downloadzen-7ab93b7f7b4f9e3b9e5101c5f216fee7f3d6e68a.tar.xz
zen-7ab93b7f7b4f9e3b9e5101c5f216fee7f3d6e68a.zip
make sure we pick up the error code before it is cleared when throwing error
Diffstat (limited to 'zencore/iobuffer.cpp')
-rw-r--r--zencore/iobuffer.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/zencore/iobuffer.cpp b/zencore/iobuffer.cpp
index 2522daf35..d037d7a85 100644
--- a/zencore/iobuffer.cpp
+++ b/zencore/iobuffer.cpp
@@ -350,10 +350,11 @@ IoBufferExtendedCore::Materialize() const
if (MappedBase == nullptr)
{
+ int32_t Error = zen::GetLastError();
#if ZEN_PLATFORM_WINDOWS
CloseHandle(NewMmapHandle);
#endif // ZEN_PLATFORM_WINDOWS
- throw std::system_error(std::error_code(zen::GetLastError(), std::system_category()),
+ throw std::system_error(std::error_code(Error, std::system_category()),
fmt::format("MapViewOfFile failed (offset {:#x}, size {:#x}) file: '{}'",
MapOffset,
MapSize,