about summary refs log tree commit diff
path: root/third_party/nix/src/libstore/local-store.cc
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/nix/src/libstore/local-store.cc')
-rw-r--r--third_party/nix/src/libstore/local-store.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/third_party/nix/src/libstore/local-store.cc b/third_party/nix/src/libstore/local-store.cc
index c513e3ac4e9d..14ba580654ab 100644
--- a/third_party/nix/src/libstore/local-store.cc
+++ b/third_party/nix/src/libstore/local-store.cc
@@ -8,6 +8,7 @@
 #include <iostream>
 
 #include <absl/strings/numbers.h>
+#include <absl/strings/str_cat.h>
 #include <absl/strings/str_split.h>
 #include <fcntl.h>
 #include <glog/logging.h>
@@ -681,11 +682,12 @@ void LocalStore::queryPathInfoUncached(
 
       info->id = useQueryPathInfo.getInt(0);
 
-      try {
-        info->narHash = Hash(useQueryPathInfo.getStr(1));
-      } catch (BadHash& e) {
-        throw Error("in valid-path entry for '%s': %s", path, e.what());
+      auto hash_ = Hash::deserialize(useQueryPathInfo.getStr(1));
+      if (!hash_.ok()) {
+        throw Error(absl::StrCat("in valid-path entry for '", path,
+                                 "': ", hash_.status().ToString()));
       }
+      info->narHash = *hash_;
 
       info->registrationTime = useQueryPathInfo.getInt(2);