onCommandFailure method
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) {
// Send error wrapped in LocalMessage
sender.tell(LocalMessage(payload: {
'success': false,
'error': error.toString(),
'commandId': command.commandId,
}));
// Clean up captured sender
_capturedSenders.remove(command.commandId);
}
}