ObjectGeneratorException class

Thrown when a generator fails to serialize an object structure into an output format (JSON, YAML, XML, etc.).

This exception indicates generator-phase failures such as:

  • Unsupported value types encountered during serialization
  • Structural inconsistencies while emitting output (e.g., writing a value outside of a mapping)
  • Invalid generator state or API misuse

Usage

throw ObjectGeneratorException(
  'Attempted to write a value outside a mapping context.',
);

Notes

  • General-purpose exception for generator failures across formats.
  • Consider using more specific subclasses if you want format-specific errors.
Inheritance
Implemented types

Constructors

ObjectGeneratorException(String message)
Thrown when a generator fails to serialize an object structure into an output format (JSON, YAML, XML, etc.).

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
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.
inherited

Operators

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