aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/hub/hydration.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2026-04-21 17:22:18 +0200
committerGitHub Enterprise <[email protected]>2026-04-21 17:22:18 +0200
commit82e222bf23dee04e6fb825037fbb4d86a9571ce0 (patch)
tree007b805500a5e23167ae8acc977efc3a6298d826 /src/zenserver/hub/hydration.cpp
parentimproved s3 hydration (#997) (diff)
downloadarchived-zen-82e222bf23dee04e6fb825037fbb4d86a9571ce0.tar.xz
archived-zen-82e222bf23dee04e6fb825037fbb4d86a9571ce0.zip
filesystem.h surface error codes (#998)
- Improvement: File copy, scan, clone, and move operations now report the underlying OS error in failure messages
Diffstat (limited to 'src/zenserver/hub/hydration.cpp')
-rw-r--r--src/zenserver/hub/hydration.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/zenserver/hub/hydration.cpp b/src/zenserver/hub/hydration.cpp
index 4b2294b49..259171b49 100644
--- a/src/zenserver/hub/hydration.cpp
+++ b/src/zenserver/hub/hydration.cpp
@@ -239,7 +239,11 @@ namespace hydration_impl {
[this, Hash = IoHash(Hash), SourcePath = std::filesystem::path(SourcePath)](std::atomic<bool>& AbortFlag) {
if (!AbortFlag.load())
{
- CopyFile(SourcePath, m_CASPath / fmt::format("{}", Hash), CopyFileOptions{.EnableClone = true});
+ std::filesystem::path DestPath = m_CASPath / fmt::format("{}", Hash);
+ if (std::error_code Ec = CopyFile(SourcePath, DestPath, CopyFileOptions{.EnableClone = true}); Ec)
+ {
+ throw std::system_error(Ec, fmt::format("Failed to copy '{}' to '{}'", SourcePath, DestPath));
+ }
}
});
}
@@ -256,7 +260,11 @@ namespace hydration_impl {
[this, Hash = IoHash(Hash), DestinationPath = std::filesystem::path(DestinationPath)](std::atomic<bool>& AbortFlag) {
if (!AbortFlag.load())
{
- CopyFile(m_CASPath / fmt::format("{}", Hash), DestinationPath, CopyFileOptions{.EnableClone = true});
+ std::filesystem::path SourcePath = m_CASPath / fmt::format("{}", Hash);
+ if (std::error_code Ec = CopyFile(SourcePath, DestinationPath, CopyFileOptions{.EnableClone = true}); Ec)
+ {
+ throw std::system_error(Ec, fmt::format("Failed to copy '{}' to '{}'", SourcePath, DestinationPath));
+ }
}
});
}