@graphty/graph-io / @graphty/graph-io / refusedSave
Function: refusedSave() ​
refusedSave(
notes,codes?):GraphFormatError|null
Defined in: common/export.ts:209
The error a save throws for the first E_ note of a check() result, or null when there is none. An exporter calls it before it writes anything, so every format refuses a save the same way: an id note (E_ID_CHARSET, E_ID_TEXT_COLLISION) throws E_INVALID_ID, E_MIXED_DIRECTION throws E_DIRECTED, E_XML_ILLEGAL_CHAR throws E_COLUMN_TYPE, and any other note E_UNSUPPORTED. Map your own note codes onto these with codes. The error's details.code is the note's code.
Parameters ​
notes ​
readonly LossNote[]
what check() returned
codes? ​
Readonly<Record<string, "E_INVALID_ID" | "E_DIRECTED" | "E_COLUMN_TYPE" | "E_UNSUPPORTED">> = {}
the error code for each of your own note codes, such as { E_PAIRS_BAD_ID: "E_INVALID_ID" }
Returns ​
GraphFormatError | null
the error to throw, or null