Broken Nodes
Edges built from real data can point at things that are not there. Rather than throw, the canvas skips an edge whose node is missing, draws an edge to a missing handle at the middle of the node's side, and draws only the first of two edges sharing an id. What counts as a mistake is reported once through OnError.
Press Tab to move between the nodes and edges of the diagram.
Press Enter or Space to select it, Shift with Enter to add it to the selection, the arrow keys to move the selected nodes, Delete to remove them and Escape to clear the selection. Press C to start a connection from it.
Press Enter or Space to select it, Delete to remove it and Escape to clear the selection. Press C to move its end to another node.
bit BlowTry it
- At the start node 3 is missing: edge e3-2 names a node that is not in the list, so it is not drawn, nothing breaks, and the footer shows
missing-edge-endpoint. - Set node 3 to present: the node joins the list and its edge to node 2's right-hand handle appears.
- Set node 3 to hidden: it stays in the list but is not drawn, and neither is its edge - and nothing is reported, since hiding a node is not a mistake.
- Tick e1-2 names a missing handle: the edge leaves node 2's left-hand handle and ends at the middle of its top side, between the two real handles. Nothing is reported for this one.
- Tick add a second edge with the id e2-4: the new edge, from node 1 to node 4, never appears - only the first edge with an id is drawn - and
duplicate-edge-idis reported. - Go back to a broken state you have seen: the footer does not repeat it, because each problem is reported once for the lifetime of the canvas.
How it works
OnErrorreceives aBlowError: a stableCode(theBlowErrorCodeconstants) and aMessagenaming the ids. It is raised after the render that found the problem, never during it.- An edge whose
SourceorTargetnames no node is not drawn and is reported asmissing-edge-endpoint. An edge to a node withHidden = trueis not drawn either, and is not an error. - An edge's
TargetHandleandSourceHandleare matched against the ids of the node's handles. With no match, the end is anchored at the middle of the node'sTargetPositionorSourcePositionside - where it is also drawn before the node's first measurement - and no error is raised. - Node 2 declares its handles through
Ports: the built-in node draws one handle per port, and the two target ports sharing the top side are spread a third and two thirds along it, which leaves the fallback anchor visible between them. - Of two edges with the same
Id, only the first in the list is drawn (duplicate-edge-id); nodes behave the same way (duplicate-node-id). The Diagnostics example breaks a graph in the other waysOnErrorreports.