summaryrefslogtreecommitdiff
path: root/src/ResultExtractor.cpp
diff options
context:
space:
mode:
authorJoel Rosdahl <joel@rosdahl.net>2020-07-28 16:46:26 +0200
committerJoel Rosdahl <joel@rosdahl.net>2020-07-28 19:56:26 +0200
commit5cc1f31ac348597b7ca9d163f4eb306d6f62e12a (patch)
tree4a2602c76cd413a63850f997db62c8a541a5b430 /src/ResultExtractor.cpp
parente9aded5ff33e68fe6f04dfedea15d7832c32ff13 (diff)
downloadccache-5cc1f31ac348597b7ca9d163f4eb306d6f62e12a.tar.gz
C++-ify {copy,write}_fd
Diffstat (limited to 'src/ResultExtractor.cpp')
-rw-r--r--src/ResultExtractor.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/ResultExtractor.cpp b/src/ResultExtractor.cpp
index 61349b05..531f0b4c 100644
--- a/src/ResultExtractor.cpp
+++ b/src/ResultExtractor.cpp
@@ -18,8 +18,7 @@
#include "ResultExtractor.hpp"
-#include "Context.hpp"
-#include "logging.hpp"
+#include "Util.hpp"
#include "third_party/nonstd/string_view.hpp"
@@ -73,8 +72,11 @@ ResultExtractor::on_entry_data(const uint8_t* data, size_t size)
{
assert(m_dest_fd);
- if (!write_fd(*m_dest_fd, data, size)) {
- throw Error(fmt::format("Failed to write to {}", m_dest_path));
+ try {
+ Util::write_fd(*m_dest_fd, data, size);
+ } catch (Error& e) {
+ throw Error(
+ fmt::format("Failed to write to {}: {}", m_dest_path, e.what()));
}
}