onCommandFailure method

  1. @override
Future<void> onCommandFailure(
  1. Command command,
  2. dynamic error
)

Called when command processing fails Override to handle command failures

Implementation

@override
Future<void> onCommandFailure(Command command, dynamic error) async {
  await super.onCommandFailure(command, error);

  // Send error response to sender if running in actor system
  final sender = _capturedSenders[command.commandId];
  if (sender != null) {
    sender.tell(ChannelCommandResult.failed(
      commandId: command.commandId,
      error: error.toString(),
    ));
    _capturedSenders.remove(command.commandId);
  }
}