YamlException class

Thrown when an error occurs while parsing or processing a YAML document.

This exception represents syntax or structural errors encountered during YAML parsing. It includes precise location information to help identify where in the source document the error occurred.

This typically occurs when:

  • The YAML document is malformed or contains invalid syntax
  • Indentation rules are violated
  • Unexpected tokens or values are encountered

Example

throw YamlException(
  'Unexpected token while parsing YAML',
  position,
);

See also

Inheritance
Implemented types

Constructors

YamlException(String message, YamlPosition position, {StackTrace? stackTrace})
Thrown when an error occurs while parsing or processing a YAML document.

Properties

cause Object?
The underlying cause of this exception, if any.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
message String
The message describing the error.
finalinherited
position → YamlPosition
The position in the YAML source where the error occurred.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stackTrace StackTrace
The associated stack trace.
finalinherited

Methods

getCause() Object
The cause of this exception, if any.
inherited
getMessage() String
The message associated with this exception.
inherited
getStackTrace() StackTrace
The stack trace associated with this exception.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.

Operators

operator ==(Object other) bool
The equality operator.
inherited