chore(3p/nix/hash): prefer StatusOr over throwing constructor
The use of `unwrap_throw` can be used as a later grep target. Change-Id: I8c54ed90c4289f07aecb8a1393dd10204c8bce4e Reviewed-on: https://cl.tvl.fyi/c/depot/+/1493 Reviewed-by: glittershark <grfn@gws.fyi> Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
This commit is contained in:
parent
2a292c71f4
commit
1cbffe21f3
15 changed files with 97 additions and 49 deletions
10
third_party/nix/src/libstore/local-store.cc
vendored
10
third_party/nix/src/libstore/local-store.cc
vendored
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue