Findings
The engine does not throw for a bad input. It gives a layout, and puts each problem in Layout.issues. Each finding has a code, a severity, a message, and the node or the edge when it applies. The detail object has the values that caused it.
interface Issue { code: IssueCode; severity: "error" | "warning"; message: string; node?: string; edge?: string; detail?: Record<string, unknown>;}- An error changed the output: the engine skipped a node or an edge, or used a default.
- A warning did not change the output, or changed it only to make it valid.
- With
strict: true, the engine throws anIrekoErrorwith all errors. Warnings do not throw.
| Code | Severity | Phase |
|---|---|---|
EMPTY_ID | error | normalize |
DUPLICATE_ID | error (nodes), warning (edges) | normalize, route |
UNKNOWN_LAYOUT | error | normalize |
UNKNOWN_ROUTER | error | options |
INVALID_OPTION | warning | options, measure |
INVALID_SIZE | error, or warning | options, normalize, measure |
UNKNOWN_EDGE_END | error | normalize |
SELF_LOOP | warning | normalize |
LIMIT_NODES, LIMIT_DEPTH, LIMIT_CHILDREN | error | normalize |
STRATEGY_FAILED | error (arrange), warning (audit) | measure, audit |
ROUTER_FAILED | error | route |
EDGE_THROUGH_BOX | warning | route |
NON_FINITE | error | measure, place |
OVERLAP | warning | audit |
ESCAPE | warning | audit |
EMPTY_ID
Section titled “EMPTY_ID”A node has no identifier, or a child is not an object. The engine skips the node and its subtree. Give each node a non-empty id.
DUPLICATE_ID
Section titled “DUPLICATE_ID”Two nodes have the same identifier. The engine keeps the first node, and skips the second node and its subtree. For edges, the engine renames the second edge id#2 and keeps it (a warning). Identifiers of nodes must be unique in the whole tree, not only in one container.
UNKNOWN_LAYOUT
Section titled “UNKNOWN_LAYOUT”A node uses a strategy that the engine does not have. The engine uses grid for it. The message lists the registered strategies. Register your strategy with createEngine({ strategies }), and check the spelling. In the text language, give the names of your strategies to parse.
UNKNOWN_ROUTER
Section titled “UNKNOWN_ROUTER”The router option names a router that the engine does not have. The engine uses straight. Register your router with createEngine({ routers }).
INVALID_OPTION
Section titled “INVALID_OPTION”An option has the wrong type or is out of its range, or the strategy has no option with that name. A mode or a fit that is not a known word, and a layout object with no type, give it too. The engine uses the default. The detail has the strategy, the option and the value. The schema of each strategy is in the options reference. This finding also applies to spacing, header, gap and padding.
INVALID_SIZE
Section titled “INVALID_SIZE”- A
sizeof a node is not a finite number more than 0 (an error). The engine uses the default for that dimension. - The
sizeof a node isnull(an error). The engine uses the default size. - The
nodeSizeoption is not a valid size (an error). The engine uses 120 by 48. - A fixed size of a container is smaller than its padding and header (a warning). The engine makes the box large enough to hold one pixel of content.
UNKNOWN_EDGE_END
Section titled “UNKNOWN_EDGE_END”An edge connects a node that is not in the tree. The engine skips the edge. Check the identifiers. A node that the engine skipped for another finding (for example DUPLICATE_ID) is not in the tree either.
An item of edges that is null or undefined gets this finding too. The engine skips it.
SELF_LOOP
Section titled “SELF_LOOP”An edge connects a node to itself. The engine skips the edge.
LIMIT_NODES
Section titled “LIMIT_NODES”The tree has more nodes than the limit of the engine (the default is 100000). The engine skips the other nodes. Change the limit with createEngine({ limits: { maxNodes } }).
LIMIT_DEPTH
Section titled “LIMIT_DEPTH”The tree is deeper than the limit (the default is 10000 levels). The engine skips the deeper nodes. The engine uses no recursion, so the limit protects the time of the layout, not the stack.
LIMIT_CHILDREN
Section titled “LIMIT_CHILDREN”A node has more children than the limit (the default is 10000). The engine skips the other children.
STRATEGY_FAILED
Section titled “STRATEGY_FAILED”- The
arrangefunction of a strategy threw, gave the wrong number of offsets, or gave an offset that is not a finite number (an error). The engine usesgridfor that node, so the layout stays valid. - The
auditfunction of a strategy threw (a warning). The engine ignores that audit.
The message has the name of the strategy and the problem. Refer to Write a strategy.
ROUTER_FAILED
Section titled “ROUTER_FAILED”A router threw, or gave fewer than two points, or a point that is not finite. The engine uses straight for that edge.
For a graph router (the option graphRouter), the finding also comes when the router gives no route for an edge. Then the edge keeps the route of the option router. When the graph router throws, the finding has no edge, and each edge keeps its route.
EDGE_THROUGH_BOX
Section titled “EDGE_THROUGH_BOX”The route of a graph router (the option graphRouter) goes through a box. The router tells it in the field through of the route. The engine keeps the route. The detail has the boxes and the name of the router.
The ends of the edge and the containers that hold an end do not count. An edge from a box in a container to a box outside it must cross the wall of the container.
To stop on this finding, examine issues for the code. The option strict does not throw for a warning.
NON_FINITE
Section titled “NON_FINITE”A position, a size or a scale of the layout is not a finite number. Each size of the input is finite, but a sum of very large sizes can overflow. The engine does not throw. It uses a finite value, so each number of the layout stays finite:
- 0 for a position, and the size of the node for its box.
- 1 for a scale, and 0 for a value of
bounds. - When the
gridfallback cannot arrange the children, the engine puts each child at the origin of the node.
The detail has the field, for example width or offsets, and the phase. Use smaller sizes, or a measure function that gives smaller sizes.
OVERLAP
Section titled “OVERLAP”Two boxes overlap, and neither box holds the other through the nested mode. The built-in strategies do not make overlaps, so look for a custom strategy that uses the boxes of the children, not their extents.
A box inside a container with the fit clip counts only for its visible part, because the renderers cut the rest.
The audit gives at most 100 overlaps. Then it gives one more finding with the full count in detail.count.
ESCAPE
Section titled “ESCAPE”A box is not inside the nested container that holds it. The built-in strategies do not make this. A custom strategy with a content rectangle that is too small can.
Findings of a strategy
Section titled “Findings of a strategy”The audit function of a strategy can give its own findings, with its own codes. IssueCode accepts any string for this reason.