RETURNS its failure rather than throwing, which is the deliberate
half of the versioned-JSON convention documented in
./document-errors.ts: a graph document describes independent
elements, so one malformed edge must not cost the caller the other
nine hundred. Element-level problems become diagnostics and the good
elements come back; only a document that cannot be read at all
produces the error branch.
The error branch carries detail, the same typed error the
throwing parsers raise, so a host can branch on code and
documentKind uniformly across the whole channel without
string-matching a message.
Parse a graph document.
RETURNS its failure rather than throwing, which is the deliberate half of the versioned-JSON convention documented in
./document-errors.ts: a graph document describes independent elements, so one malformed edge must not cost the caller the other nine hundred. Element-level problems become diagnostics and the good elements come back; only a document that cannot be read at all produces theerrorbranch.The
errorbranch carriesdetail, the same typed error the throwing parsers raise, so a host can branch oncodeanddocumentKinduniformly across the whole channel without string-matching a message.