Skip to content
Playground(another site)

bynk.event.duplicate_handler

Error A from Events service declares more than one on event handler; it has exactly one.

A from Events(E) service has exactly one on event handler. To react to an event in two ways, declare two services, each subscribing to it: every subscriber is delivered to independently. So the second handler is refused here, and the fix is to move it into a service of its own.

Example

service onPaid from Events(Paid) {
on event(e: Paid) -> Effect[()] { … }
on event(e: Paid) -> Effect[()] { … } // ✗ a service has one `on event` handler
}
service onPaidAudit from Events(Paid) { // ✓ a second subscriber, delivered to separately
on event(e: Paid) -> Effect[()] { … }
}

In the Book

See also

  • The grammar rule it governs: event_handler.
  • Every code in its category, Events, on the diagnostic index.
  • bynk explain bynk.event.duplicate_handler shows the same from the installed toolchain, without a network.