Skip to content

@graphty/layout / index / LayoutErrorCode

Type Alias: LayoutErrorCode ​

LayoutErrorCode = "E_BAD_OPTION" | "E_BAD_NODE" | "E_UNKNOWN_COLUMN" | "E_COLUMN_TYPE" | "E_BAD_WEIGHT" | "E_NOT_PLANAR" | "E_NOT_CONNECTED" | "E_TOO_LARGE"

Defined in: indexed/common.ts:33

The stable code a layout's refusal carries, beside params holding its facts, so a caller can tell the cases apart without matching message text (which may change):

  • E_BAD_OPTION: an option is out of range or not one of its values; params { option, value }, or for an array of the wrong length { option, length, expected }.
  • E_BAD_NODE: an option names a node index (or id) that is not a node of the graph; params { option, index }.
  • E_UNKNOWN_COLUMN: an option names a node column the snapshot does not hold; params { option, column }.
  • E_BAD_WEIGHT: an edge weight the layout cannot use (kamadaKawai's weights are distances, so >= 0); params{ weight }.
  • E_COLUMN_TYPE: an option names a node column of a dtype the layout cannot read; params{ option, column, dtype, expected }.
  • E_NOT_PLANAR, E_NOT_CONNECTED, E_TOO_LARGE: the graph lacks a property the layout needs, or is too large.

The thrown object stays the Error it was before codes existed.