bynk.event.emit_outside_owner
Error Events.emit[E] named an event E not declared in the emitting context — only an event's declaring context may emit it.
Only the context that declares an event may emit it. A consumer can see the event through consumes, to subscribe to it with from Events(…), but being able to name a type does not make it yours to forge: other contexts then could not trust that an event came from its owner. Emit an event of your own, or call a service of the owning context and let it emit.
Example
context orders
exports transparent { Paid }
event Paid = { id: String }
// mailer.bynkcontext mailer
consumes ordersconsumes bynk { Events }
event Sent = { id: String }
Events.emit[Paid](Paid { id: "x" }) // ✗ `Paid` belongs to `orders`Events.emit[Sent](Sent { id: "x" }) // ✓ `Sent` is declared hereIn the Book
See also
- Every code in its category, Events, on the diagnostic index.
bynk explain bynk.event.emit_outside_ownershows the same from the installed toolchain, without a network.