onSnapshotRestorationFailure method

  1. @override
Future<void> onSnapshotRestorationFailure(
  1. dynamic snapshotData,
  2. int sequenceNumber,
  3. dynamic error
)

A snapshot that cannot be restored fails recovery instead of eventador's default (empty state plus only the events after the snapshot).

Implementation

@override
Future<void> onSnapshotRestorationFailure(
    dynamic snapshotData, int sequenceNumber, dynamic error) async {
  throw StateError('Invoice $aggregateId: snapshot at $sequenceNumber cannot be restored '
      '(refusing to recover from the events after it alone): $error');
}