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
7
third_party/nix/src/libutil/hash.hh
vendored
7
third_party/nix/src/libutil/hash.hh
vendored
|
|
@ -36,12 +36,15 @@ struct Hash {
|
|||
Subresource Integrity hash expression). If the 'type' argument
|
||||
is htUnknown, then the hash type must be specified in the
|
||||
string. */
|
||||
Hash(const std::string& s, HashType type = htUnknown);
|
||||
Hash(std::string_view s, HashType type = htUnknown);
|
||||
|
||||
/* Status-returning version of above constructor */
|
||||
static absl::StatusOr<Hash> deserialize(const std::string& s,
|
||||
static absl::StatusOr<Hash> deserialize(std::string_view s,
|
||||
HashType type = htUnknown);
|
||||
|
||||
// Legacy unwrapper for StatusOr. Throws BadHash.
|
||||
static Hash unwrap_throw(absl::StatusOr<Hash> hash) noexcept(false);
|
||||
|
||||
void init();
|
||||
|
||||
/* Check whether a hash is set. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue