about summary refs log tree commit diff
path: root/third_party/nix/src/libstore/nar-info.cc
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/nix/src/libstore/nar-info.cc')
-rw-r--r--third_party/nix/src/libstore/nar-info.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/third_party/nix/src/libstore/nar-info.cc b/third_party/nix/src/libstore/nar-info.cc
index aa764f4a16a0..ec9f882f4fb4 100644
--- a/third_party/nix/src/libstore/nar-info.cc
+++ b/third_party/nix/src/libstore/nar-info.cc
@@ -14,11 +14,13 @@ NarInfo::NarInfo(const Store& store, const std::string& s,
   };
 
   auto parseHashField = [&](const std::string& s) {
-    try {
-      return Hash(s);
-    } catch (BadHash&) {
+    auto hash_ = Hash::deserialize(s);
+    if (hash_.ok()) {
+      return *hash_;
+    } else {
+      // TODO(#statusor): return an actual error
       corrupt();
-      return Hash();  // never reached
+      return Hash();
     }
   };