1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-28 13:41:15 +02:00

Elaborate the "unknown hash algorithm" error

List the allowed hash formats
This commit is contained in:
Yueh-Shun Li 2023-10-09 11:00:14 +08:00
parent e9ddf0b400
commit aff177d860
2 changed files with 2 additions and 2 deletions

View file

@ -1084,7 +1084,7 @@ namespace nix {
ASSERT_TRACE1("hashString \"foo\" \"content\"", ASSERT_TRACE1("hashString \"foo\" \"content\"",
UsageError, UsageError,
hintfmt("unknown hash algorithm '%s'", "foo")); hintfmt("unknown hash algorithm '%s', expect 'md5', 'sha1', 'sha256', or 'sha512'", "foo"));
ASSERT_TRACE2("hashString \"sha256\" {}", ASSERT_TRACE2("hashString \"sha256\" {}",
TypeError, TypeError,

View file

@ -401,7 +401,7 @@ HashType parseHashType(std::string_view s)
if (opt_h) if (opt_h)
return *opt_h; return *opt_h;
else else
throw UsageError("unknown hash algorithm '%1%'", s); throw UsageError("unknown hash algorithm '%1%', expect 'md5', 'sha1', 'sha256', or 'sha512'", s);
} }
std::string_view printHashType(HashType ht) std::string_view printHashType(HashType ht)