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

@ -167,7 +167,8 @@ static int _main(int argc, char** argv) {
Hash expectedHash(ht);
Path storePath;
if (args.size() == 2) {
expectedHash = Hash(args[1], ht);
auto expectedHash_ = Hash::deserialize(args[1], ht);
expectedHash = Hash::unwrap_throw(expectedHash);
storePath = store->makeFixedOutputPath(unpack, expectedHash, name);
if (store->isValidPath(storePath)) {
hash = expectedHash;