diff options
| -rw-r--r-- | zen/internalfile.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/zen/internalfile.cpp b/zen/internalfile.cpp index 1eab04486..fc473b241 100644 --- a/zen/internalfile.cpp +++ b/zen/internalfile.cpp @@ -2,6 +2,7 @@ #include "internalfile.h" +#include <zencore/except.h> #include <zencore/filesystem.h> #include <zencore/fmtutils.h> #include <zencore/logging.h> @@ -152,7 +153,7 @@ InternalFile::OpenWrite(std::filesystem::path FileName, bool IsCreate) if (FAILED(hRes)) { using namespace fmt::literals; - throw std::system_error(GetLastError(), std::system_category(), "Failed to open file for writing: '{}'"_format(FileName)); + zen::ThrowLastError("Failed to open file for writing: '{}'"_format(FileName)); } } @@ -166,7 +167,7 @@ InternalFile::OpenRead(std::filesystem::path FileName) if (FAILED(hRes)) { using namespace fmt::literals; - throw std::system_error(GetLastError(), std::system_category(), "Failed to open file for reading: '{}'"_format(FileName)); + zen::ThrowLastError("Failed to open file for reading: '{}'"_format(FileName)); } } @@ -201,9 +202,7 @@ InternalFile::Read(void* Data, uint64_t Size, uint64_t Offset) if (FAILED(hRes)) { using namespace fmt::literals; - throw std::system_error(GetLastError(), - std::system_category(), - "Failed to read from file '{}'"_format(zen::PathFromHandle(m_File))); + zen::ThrowLastError("Failed to read from file '{}'"_format(""));//zen::PathFromHandle(m_File))); } } @@ -220,7 +219,7 @@ InternalFile::Write(const void* Data, uint64_t Size, uint64_t Offset) if (FAILED(hRes)) { using namespace fmt::literals; - throw std::system_error(GetLastError(), std::system_category(), "Failed to write to file '{}'"_format(zen::PathFromHandle(m_File))); + zen::ThrowLastError("Failed to write to file '{}'"_format(""));//zen::PathFromHandle(m_File))); } } |