From 55f2fcf886f96f1ad05df2ea87c6478f4ff09edb Mon Sep 17 00:00:00 2001 From: Jim Riecken Date: Tue, 11 Dec 2018 15:40:27 -0800 Subject: [PATCH] Update README to document new cycle error type --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 29bdd82..5733725 100644 --- a/README.md +++ b/README.md @@ -18,16 +18,16 @@ Nodes in the graph are just simple strings with optional data associated with th - `removeNode(name)` - remove a node from the graph - `hasNode(name)` - check if a node exists in the graph - `size()` - return the number of nodes in the graph - - `getNodeData(name)` - get the data associated with a node (will throw an Error if the node does not exist) - - `setNodeData(name, data)` - set the data for an existing node (will throw an Error if the node does not exist) - - `addDependency(from, to)` - add a dependency between two nodes (will throw an Error if one of the nodes does not exist) + - `getNodeData(name)` - get the data associated with a node (will throw an `Error` if the node does not exist) + - `setNodeData(name, data)` - set the data for an existing node (will throw an `Error` if the node does not exist) + - `addDependency(from, to)` - add a dependency between two nodes (will throw an `Error` if one of the nodes does not exist) - `removeDependency(from, to)` - remove a dependency between two nodes - `clone()` - return a clone of the graph. Any data attached to the nodes will only be *shallow-copied* - `dependenciesOf(name, leavesOnly)` - get an array containing the nodes that the specified node depends on (transitively). If `leavesOnly` is true, only nodes that do not depend on any other nodes will be returned in the array. - `dependantsOf(name, leavesOnly)` - get an array containing the nodes that depend on the specified node (transitively). If `leavesOnly` is true, only nodes that do not have any dependants will be returned in the array. - `overallOrder(leavesOnly)` - construct the overall processing order for the dependency graph. If `leavesOnly` is true, only nodes that do not depend on any other nodes will be returned. -Dependency Cycles are detected when running `dependenciesOf`, `dependantsOf`, and `overallOrder` and if one is found, an error will be thrown that includes what the cycle was in the message: e.g. `Dependency Cycle Found: a -> b -> c -> a`. If you wish to silence this error, pass `circular: true` when instantiating `DepGraph` (more below). +Dependency Cycles are detected when running `dependenciesOf`, `dependantsOf`, and `overallOrder` and if one is found, a `DepGraphCycleError` will be thrown that includes what the cycle was in the message as well as the `cyclePath` property: e.g. `Dependency Cycle Found: a -> b -> c -> a`. If you wish to silence this error, pass `circular: true` when instantiating `DepGraph` (more below). ## Examples