Skip to content

EncodeError

Raised when encode is given a value that can't be written as YAML as it stands.

Example

let items = []
items.push $items
try
  encode {items: $items}
catch EncodeError: err
  echo "can't encode $(err.path): $err"

Inherits from: std.ValueError

Fields

kind @ (:CYCLE: | :RANGE:) [get]

Why the value can't be written.

Kind Meaning
:CYCLE: The value contains itself.
:RANGE: An Int is outside the signed 64-bit range.
path @ Tuple[...EncodeValue] [get]

Keys and indices that lead from the encoded value to the fault.

For :CYCLE: the path leads to the repeated container, and for :RANGE: to the Int. When the fault is inside a key, the path leads to the mapping holding that key. Each key is the one in the encoded value.