fetchnuget: improve "multiple hashes" error message

This commit is contained in:
Rebecca Turner 2025-03-25 10:00:54 -07:00
parent 33044b9bd8
commit 5aa2e930ec
No known key found for this signature in database

View File

@ -1,4 +1,5 @@
{
lib,
fetchurl,
buildDotnetPackage,
unzip,
@ -14,10 +15,12 @@ attrs@{
...
}:
if md5 != "" then
throw "fetchnuget does not support md5 anymore, please use 'hash' attribute with SRI hash"
throw "fetchnuget does not support md5 anymore, please use 'hash' attribute with SRI hash: ${
lib.generators.toPretty { } attrs
}"
# This is also detected in fetchurl, but we just throw here to avoid confusion
else if (sha256 != "" && hash != "") then
throw "multiple hashes passed to fetchNuGet"
throw "multiple hashes passed to fetchNuGet: ${lib.generators.toPretty { } url}"
else
buildDotnetPackage (
{