DisposalFailedException class

Exception thrown when a lifecycle operation fails during disposal.

This is used to wrap exceptions that occur during disposal callbacks, particularly when disposing children in a manager.

Example:

final manager = RaiiManager()..initLifecycle();

RaiiBox.withLifecycle(
  manager,
  instance: 'resource',
  dispose: (_, __) {
    throw Exception('Disposal failed!');
  },
);

try {
  manager.disposeLifecycle();
} on DisposalFailedException catch (e) {
  print('Disposal error: ${e.message}');
  print('Original error: ${e.originalException}');
}
Inheritance

Constructors

DisposalFailedException(String message, {Object? originalException, StackTrace? originalStackTrace})
Creates an exception wrapping a disposal failure.
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
message → String
A description of the error.
finalinherited
originalException → Object?
The original exception that caused the disposal failure.
final
originalStackTrace → StackTrace?
The original stack trace from the disposal failure.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override

Operators

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