diff options
author | Kane York <kanepyork@gmail.com> | 2020-07-28T02·57-0700 |
---|---|---|
committer | kanepyork <rikingcoding@gmail.com> | 2020-08-01T01·15+0000 |
commit | 1cbffe21f3284fbad10b4ca27b0d8381bd554ff3 (patch) | |
tree | 921c90af406f009a660bb82eb40324a459bca7b7 /third_party/nix/src/libstore/derivations.cc | |
parent | 2a292c71f40f3592e33534ee6d63eb2ca5221d5e (diff) |
chore(3p/nix/hash): prefer StatusOr over throwing constructor r/1515
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
Diffstat (limited to 'third_party/nix/src/libstore/derivations.cc')
-rw-r--r-- | third_party/nix/src/libstore/derivations.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/third_party/nix/src/libstore/derivations.cc b/third_party/nix/src/libstore/derivations.cc index 208e7e981c4a..243aa0a242f7 100644 --- a/third_party/nix/src/libstore/derivations.cc +++ b/third_party/nix/src/libstore/derivations.cc @@ -13,6 +13,7 @@ namespace nix { +// TODO(#statusor): looks like easy absl::Status conversion void DerivationOutput::parseHashInfo(bool& recursive, Hash& hash) const { recursive = false; std::string algo = hashAlgo; @@ -27,7 +28,8 @@ void DerivationOutput::parseHashInfo(bool& recursive, Hash& hash) const { throw Error(format("unknown hash algorithm '%1%'") % algo); } - hash = Hash(this->hash, hashType); + auto hash_ = Hash::deserialize(this->hash, hashType); + hash = Hash::unwrap_throw(hash_); } BasicDerivation BasicDerivation::from_proto( |