aboutsummaryrefslogtreecommitdiff
path: root/zenstore
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 /zenstore
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 'zenstore')
-rw-r--r--zenstore/caslog.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/zenstore/caslog.cpp b/zenstore/caslog.cpp
index 0f918bfd8..6d9e22f88 100644
--- a/zenstore/caslog.cpp
+++ b/zenstore/caslog.cpp
@@ -5,6 +5,8 @@
#include "CompactCas.h"
#include <zencore/except.h>
+#include <zencore/filesystem.h>
+#include <zencore/fmtutils.h>
#include <zencore/memory.h>
#include <zencore/string.h>
#include <zencore/thread.h>
@@ -12,6 +14,7 @@
#include <xxhash.h>
+#include <spdlog/spdlog.h>
#include <gsl/gsl-lite.hpp>
#include <functional>
@@ -24,6 +27,8 @@ struct IUnknown; // Workaround for "combaseapi.h(229): error C2187: syntax erro
namespace zen {
+using namespace fmt::literals;
+
uint32_t
CasLogFile::FileHeader::ComputeChecksum()
{
@@ -49,7 +54,7 @@ CasLogFile::Open(std::filesystem::path FileName, size_t RecordSize, bool IsCreat
if (FAILED(hRes))
{
- throw std::system_error(GetLastError(), std::system_category(), "Failed to open log file" /* TODO: add path */);
+ throw std::system_error(GetLastError(), std::system_category(), "Failed to open log file '{}'"_format(FileName));
}
uint64_t AppendOffset = 0;
@@ -135,7 +140,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" /* TODO: add context */);
+ throw std::system_error(GetLastError(), std::system_category(), "Failed to write to log file '{}'"_format(zen::PathFromHandle(m_File)));
}
}
@@ -156,7 +161,7 @@ CasBlobFile::Open(std::filesystem::path FileName, bool isCreate)
if (FAILED(hRes))
{
- throw std::system_error(GetLastError(), std::system_category(), "Failed to open bucket sobs file");
+ throw std::system_error(GetLastError(), std::system_category(), "Failed to open bucket sobs file '{}'"_format(FileName));
}
}
@@ -172,7 +177,7 @@ CasBlobFile::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)));
}
}
@@ -198,7 +203,7 @@ CasBlobFile::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)));
}
}