bynk.event.return_not_effect_unit
Error An on event handler returns an Effect of something other than (); emission is fire-and-forget, so it returns Effect[()].
Emission is fire-and-forget: nothing receives a subscriber's result, so an on event handler returns Effect[()] and anything else is refused. Return Effect.pure(()) once its work is done, and move a value it computes into an effect the handler performs, such as a write. A handler that does not return an Effect at all is bynk.service.return_not_effect.
Example
service onPaid from Events(Paid) { on event(e: Paid) -> Effect[Int] { … } // ✗ the result has nowhere to go 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.return_not_effect_unitshows the same from the installed toolchain, without a network.