diff options
| author | Dan Engelbrecht <[email protected]> | 2026-04-21 17:22:18 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2026-04-21 17:22:18 +0200 |
| commit | 82e222bf23dee04e6fb825037fbb4d86a9571ce0 (patch) | |
| tree | 007b805500a5e23167ae8acc977efc3a6298d826 /src/zen/cmds/dedup_cmd.cpp | |
| parent | improved s3 hydration (#997) (diff) | |
| download | archived-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/zen/cmds/dedup_cmd.cpp')
| -rw-r--r-- | src/zen/cmds/dedup_cmd.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/zen/cmds/dedup_cmd.cpp b/src/zen/cmds/dedup_cmd.cpp index 9ef50a97d..18ad56aec 100644 --- a/src/zen/cmds/dedup_cmd.cpp +++ b/src/zen/cmds/dedup_cmd.cpp @@ -240,7 +240,12 @@ DedupCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) { zen::BLAKE3Stream b3s; - zen::ScanFile(Entry.path(), 64 * 1024, [&](const void* Data, size_t Size) { b3s.Append(Data, Size); }); + if (std::error_code ScanEc = + zen::ScanFile(Entry.path(), 64 * 1024, [&](const void* Data, size_t Size) { b3s.Append(Data, Size); }); + ScanEc) + { + throw std::system_error(ScanEc, fmt::format("Failed to scan file '{}'", Entry.path())); + } Hash = b3s.GetHash(); } @@ -279,7 +284,11 @@ DedupCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv) Options.EnableClone = true; Options.MustClone = true; - zen::CopyFile(Dupe->path(), Entry.path(), Options); + if (std::error_code Ec = zen::CopyFile(Dupe->path(), Entry.path(), Options); Ec) + { + ZEN_ERROR("Failed to clone '{}' to '{}': {}", Dupe->path(), Entry.path(), Ec.message()); + continue; + } DupeBytes += Entry.file_size(); } |