mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-10-17 05:59:33 +00:00
lib/dag: improve dependency cycle error message
This commit is contained in:
parent
e1fd607e3f
commit
11fd1b7083
1 changed files with 3 additions and 2 deletions
|
@ -8,7 +8,7 @@
|
||||||
# - the addition of the function `entryBefore` indicating a "wanted
|
# - the addition of the function `entryBefore` indicating a "wanted
|
||||||
# by" relationship.
|
# by" relationship.
|
||||||
{lib}: let
|
{lib}: let
|
||||||
inherit (builtins) isAttrs attrValues attrNames elem all head tail length toJSON isString;
|
inherit (builtins) isAttrs attrValues attrNames elem all head tail length toJSON isString removeAttrs;
|
||||||
inherit (lib.attrsets) filterAttrs mapAttrs;
|
inherit (lib.attrsets) filterAttrs mapAttrs;
|
||||||
inherit (lib.lists) toposort;
|
inherit (lib.lists) toposort;
|
||||||
inherit (lib.nvim.dag) empty isEntry entryBetween entryAfter entriesBetween entryAnywhere topoSort;
|
inherit (lib.nvim.dag) empty isEntry entryBetween entryAfter entriesBetween entryAnywhere topoSort;
|
||||||
|
@ -169,10 +169,11 @@ in {
|
||||||
else value)
|
else value)
|
||||||
dag;
|
dag;
|
||||||
sortedDag = topoSort finalDag;
|
sortedDag = topoSort finalDag;
|
||||||
|
loopDetail = map (loops: removeAttrs loops ["data"]) sortedDag.loops;
|
||||||
result =
|
result =
|
||||||
if sortedDag ? result
|
if sortedDag ? result
|
||||||
then mapResult sortedDag.result
|
then mapResult sortedDag.result
|
||||||
else abort ("Dependency cycle in ${name}: " + toJSON sortedDag);
|
else abort ("Dependency cycle in ${name}: " + toJSON loopDetail);
|
||||||
in
|
in
|
||||||
result;
|
result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue