Skip to content

EncodeError

Raised when encode is given a document whose tree contains itself.

Mutation checks keep every other fault out of a tree.

Example

let root = Element root
root.push $root
try
  encode (Document $root)
catch EncodeError: err
  echo "cycle at $(err.path)"

Inherits from: std.ValueError

Fields

kind @ :CYCLE: [get]

Why the document can't be written.

Kind Meaning
:CYCLE: An element contains itself.
path @ Tuple[...Int] [get]

Child indices that lead from the document to the repeated element.

The first is an index into children of the document, and each further one an index into the children of the element before.