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:
Kane York 2020-07-27 19:57:04 -07:00 committed by kanepyork
parent 2a292c71f4
commit 1cbffe21f3
15 changed files with 97 additions and 49 deletions

View file

@ -226,10 +226,13 @@ class NarInfoDiskCacheImpl final : public NarInfoDiskCache {
narInfo->url = queryNAR.getStr(2);
narInfo->compression = queryNAR.getStr(3);
if (!queryNAR.isNull(4)) {
narInfo->fileHash = Hash(queryNAR.getStr(4));
auto hash_ = Hash::deserialize(queryNAR.getStr(4));
// TODO(#statusor): does this throw mess with retrySQLite?
narInfo->fileHash = Hash::unwrap_throw(hash_);
}
narInfo->fileSize = queryNAR.getInt(5);
narInfo->narHash = Hash(queryNAR.getStr(6));
auto hash_ = Hash::deserialize(queryNAR.getStr(6));
narInfo->narHash = Hash::unwrap_throw(hash_);
narInfo->narSize = queryNAR.getInt(7);
for (auto r : absl::StrSplit(queryNAR.getStr(8), absl::ByChar(' '))) {
narInfo->references.insert(absl::StrCat(cache.storeDir, "/", r));