mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-07-06 17:13:24 -05:00
lib.fetchers: remove throwIf usage
throwIf sends our error message through a function call, even if the error condition doesn't trigger. This requires a lot of thunk allocation that can be easily avoided.
This commit is contained in:
parent
ce99cfa103
commit
c81b12b698
1 changed files with 1 additions and 2 deletions
|
|
@ -22,7 +22,6 @@ let
|
|||
concatMapStringsSep
|
||||
head
|
||||
length
|
||||
throwIf
|
||||
;
|
||||
inherit (lib.attrsets)
|
||||
attrsToList
|
||||
|
|
@ -130,7 +129,7 @@ rec {
|
|||
hashesAsNVPairs = attrsToList (intersectAttrs hashSet args);
|
||||
in
|
||||
if hashesAsNVPairs == [ ] then
|
||||
throwIf required "fetcher called without `hash`" null
|
||||
if required then throw "fetcher called without `hash`" else null
|
||||
else if length hashesAsNVPairs != 1 then
|
||||
throw "fetcher called with mutually-incompatible arguments: ${
|
||||
concatMapStringsSep ", " (a: a.name) hashesAsNVPairs
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue