onSnapshotRestorationFailure method

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

A snapshot that cannot be restored must fail recovery. Eventador's default falls back to the empty state and then replays only the events after the snapshot, silently dropping the wallet's history.

Implementation

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