diff options
Diffstat (limited to 'zenstore/basicfile.cpp')
| -rw-r--r-- | zenstore/basicfile.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/zenstore/basicfile.cpp b/zenstore/basicfile.cpp index 05af4f792..0164a45ee 100644 --- a/zenstore/basicfile.cpp +++ b/zenstore/basicfile.cpp @@ -2,6 +2,7 @@ #include <zencore/filesystem.h> #include <zencore/fmtutils.h> +#include <zencore/except.h> #include <fmt/format.h> #include <gsl/gsl-lite.hpp> @@ -19,7 +20,7 @@ BasicFile::Open(std::filesystem::path FileName, bool isCreate) if (FAILED(hRes)) { - throw std::system_error(GetLastError(), std::system_category(), "Failed to open bucket sobs file '{}'"_format(FileName)); + ThrowSystemException(hRes, "Failed to open bucket sobs file '{}'"_format(FileName)); } } @@ -35,9 +36,7 @@ BasicFile::Read(void* Data, uint64_t Size, uint64_t Offset) if (FAILED(hRes)) { - throw std::system_error(GetLastError(), - std::system_category(), - "Failed to read from file '{}'"_format(zen::PathFromHandle(m_File))); + ThrowSystemException(hRes, "Failed to read from file '{}'"_format(zen::PathFromHandle(m_File))); } } @@ -63,7 +62,7 @@ BasicFile::Write(const void* Data, uint64_t Size, uint64_t Offset) if (FAILED(hRes)) { - throw std::system_error(GetLastError(), std::system_category(), "Failed to write to file '{}'"_format(zen::PathFromHandle(m_File))); + ThrowSystemException(hRes, "Failed to write to file '{}'"_format(zen::PathFromHandle(m_File))); } } @@ -82,4 +81,4 @@ BasicFile::FileSize() return uint64_t(Sz); } -} +} // namespace zen |