orThrow method

Actor orThrow([
  1. Object exception()?
])

Creates the actor. If no condition is met, an exception is thrown.

Implementation

Actor orThrow([Object Function()? exception]) {
  _conditions.add(_Condition(
    (ctx, msg) => true,
    (ctx, msg) => throw exception?.call() ?? MessageNotHandledException(),
  ));
  return _actor();
}