Skip to content
Playground(another site)

bynk.event.pattern_variant_payload

Error A from Events(E { ... }) subscription pattern's variant value names a variant that carries a payload — only nullary variants are admitted, since testing the tag alone would silently ignore the payload.

A pattern can test only which variant a field holds, not what it carries. For a variant with a payload that would admit emissions the pattern looks as if it excludes, so only payload-free variants are allowed. Subscribe to a payload-free variant, or drop the pattern and read the field in the handler's body.

Example

type Region =
| Domestic
| International
| Refunded(reason: String)
event Paid = { id: String, region: Region }
service onPaid from Events(Paid { region: Region.Refunded, .. }) { // ✗ `Refunded` carries a `reason`
service onPaid from Events(Paid { region: Region.Domestic, .. }) { // ✓ no payload

In the Book

See also

  • Every code in its category, Events, on the diagnostic index.
  • bynk explain bynk.event.pattern_variant_payload shows the same from the installed toolchain, without a network.