aboutsummaryrefslogtreecommitdiff
path: root/zenserver/cache/cachestore.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-05-11 18:36:30 +0200
committerStefan Boberg <[email protected]>2021-05-11 18:36:30 +0200
commit3b95585ecc08e26eded7fea4d61d4b092f5fbd2d (patch)
tree564653d4d06ca30830cf07d3c1e4b0721552a11a /zenserver/cache/cachestore.cpp
parentAdded PathFromHandle helper function (diff)
downloadzen-3b95585ecc08e26eded7fea4d61d4b092f5fbd2d.tar.xz
zen-3b95585ecc08e26eded7fea4d61d4b092f5fbd2d.zip
Added paths as context to I/O error exception messages
Diffstat (limited to 'zenserver/cache/cachestore.cpp')
-rw-r--r--zenserver/cache/cachestore.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/zenserver/cache/cachestore.cpp b/zenserver/cache/cachestore.cpp
index fc218de6b..5b0358994 100644
--- a/zenserver/cache/cachestore.cpp
+++ b/zenserver/cache/cachestore.cpp
@@ -7,6 +7,7 @@
#include <fmt/core.h>
#include <spdlog/spdlog.h>
#include <zencore/filesystem.h>
+#include <zencore/fmtutils.h>
#include <zencore/iobuffer.h>
#include <zencore/string.h>
#include <zencore/thread.h>
@@ -18,6 +19,7 @@
#include <atlfile.h>
using namespace zen;
+using namespace fmt::literals;
namespace UE {
@@ -720,7 +722,9 @@ ZenFile::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" /* TODO: add context */);
+ throw std::system_error(GetLastError(),
+ std::system_category(),
+ "Failed to read from file '{}'"_format(zen::PathFromHandle(m_File)));
}
}
@@ -736,7 +740,7 @@ ZenFile::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" /* TODO: add context */);
+ throw std::system_error(GetLastError(), std::system_category(), "Failed to write to file '{}'"_format(zen::PathFromHandle(m_File)));
}
}