dagrejs / dagre-d3

A D3-based renderer for Dagre
MIT License
2.84k stars 587 forks source link

Throw in preProcessGraph if node or edge does not exist #311

Closed lutzroeder closed 6 years ago

cpettitt commented 6 years ago

In both cases the node or edge is in the graph - we get the ID by iterating over the node and edge lists. It seems the error (if we believe it is an error) is that the node (or edge) does not have an object label. I'd be OK with failing silently in that case because it implies that there are no attributes to be read. If _.has blows up on null or undefined then a better error message is warranted, or just fail silently. Whatever we do should be consistent for all non-object cases, though.

Also, a test case would be great for this patch.