Skip to content

DecodeError

Raised when decode is given invalid YAML, or YAML that uses a feature it doesn't support.

Example

try
  decode "[1,"
catch DecodeError: err
  echo "bad YAML at line $(err.line), column $(err.column)"

Inherits from: std.DataError

Fields

column @ Int [get]

Column of the fault, counting from 1.

kind @ (:SYNTAX: | :UNSUPPORTED: | :DOCUMENTS: | :RANGE:) [get]

What is wrong with the document.

Kind Meaning
:SYNTAX: The text is not well-formed YAML, or ends inside a value.
:UNSUPPORTED: The document uses a tag or an alias.
:DOCUMENTS: The input holds no document, or more than one.
:RANGE: An integer is too large for an Int.
line @ Int [get]

Line of the fault, counting from 1.