From 46ef2fbd49b2e48206a0554ae9a7d84f5961d817 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sat, 15 May 2021 23:36:29 +0300 Subject: use error reporting from winapi-common --- src/utils/file.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/utils') diff --git a/src/utils/file.cpp b/src/utils/file.cpp index af1de6e..fdc695f 100644 --- a/src/utils/file.cpp +++ b/src/utils/file.cpp @@ -5,6 +5,7 @@ #include +#include #include #include @@ -27,12 +28,12 @@ std::size_t get_size(const std::string& path) { NULL)}; if (handle.get() == INVALID_HANDLE_VALUE) - throw error::windows(GetLastError(), "CreateFileW"); + throw winapi::error::windows(GetLastError(), "CreateFileW"); LARGE_INTEGER size; if (!GetFileSizeEx(handle.get(), &size)) - throw error::windows(GetLastError(), "GetFileSizeEx"); + throw winapi::error::windows(GetLastError(), "GetFileSizeEx"); if (size.QuadPart < 0 || size.QuadPart > SIZE_MAX) throw std::runtime_error{"invalid file size"}; @@ -49,12 +50,12 @@ ID query_id(const std::string& path) { NULL)}; if (handle.get() == INVALID_HANDLE_VALUE) - throw error::windows(GetLastError(), "CreateFileW"); + throw winapi::error::windows(GetLastError(), "CreateFileW"); FILE_ID_INFO id; if (!GetFileInformationByHandleEx(handle.get(), FileIdInfo, &id, sizeof(id))) - throw error::windows(GetLastError(), "GetFileInformationByHandleEx"); + throw winapi::error::windows(GetLastError(), "GetFileInformationByHandleEx"); return {id}; } -- cgit v1.2.3