aboutsummaryrefslogtreecommitdiff
path: root/zenstore/caslog.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-05-21 21:17:12 +0200
committerStefan Boberg <[email protected]>2021-05-21 21:17:12 +0200
commit9f62b35a7380db253cce3310fa5208b8c8e20ef5 (patch)
treeea6bdb2a876649c2eb5e1142d9c1a2a2d1c96ca8 /zenstore/caslog.cpp
parentRenamed CasBlobFile -> BasicFile (diff)
downloadzen-9f62b35a7380db253cce3310fa5208b8c8e20ef5.tar.xz
zen-9f62b35a7380db253cce3310fa5208b8c8e20ef5.zip
Cleaned up exception handling
We now use std::system_error where possible to report Win32 system errors. We still have WindowsException for general HRESULT based errors but we should phase it out where possible
Diffstat (limited to 'zenstore/caslog.cpp')
-rw-r--r--zenstore/caslog.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/zenstore/caslog.cpp b/zenstore/caslog.cpp
index 4b9aacb42..0ef3ed1bd 100644
--- a/zenstore/caslog.cpp
+++ b/zenstore/caslog.cpp
@@ -125,7 +125,10 @@ CasLogFile::Replay(std::function<void(const void*)>&& Handler)
m_File.Seek(LogBaseOffset, FILE_BEGIN);
HRESULT hRes = m_File.Read(ReadBuffer.data(), gsl::narrow<DWORD>(LogDataSize));
- zen::ThrowIfFailed(hRes, "Failed to read log file");
+ if (FAILED(hRes))
+ {
+ zen::ThrowSystemException(hRes, "Failed to read log file");
+ }
for (int i = 0; i < LogEntryCount; ++i)
{
@@ -140,9 +143,7 @@ CasLogFile::Append(const void* DataPointer, uint64_t DataSize)
if (FAILED(hRes))
{
- throw std::system_error(GetLastError(),
- std::system_category(),
- "Failed to write to log file '{}'"_format(zen::PathFromHandle(m_File)));
+ zen::ThrowSystemException(hRes, "Failed to write to log file '{}'"_format(zen::PathFromHandle(m_File)));
}
}