Skip to content
Playground(another site)

bynk.within.outside_handler

Error e.within(d) was used outside a service handler's body and outside a function (in a provider operation, a WebSocket handler or a test case body), where no execution context exists.

within hands the effect it abandons on a timeout to the execution context, which only a service handler's body, or a function's it calls, has. A WebSocket handler, a provider operation and a test case have none. Move the within into a service handler or a function, and have the case call that, simulating a slow call with stub … after. In an agent handler the rule is bynk.within.in_agent_handler.

Example

tests/t.test.bynk
let r <- Slow("a").get().within(1.second) // ✗ a case has no execution context
let r <- quotes.call() // ✓ the service handler bounds it

In the Book

See also

  • The grammar rule it governs: method_call.
  • Every code in its category, Other, on the diagnostic index.
  • bynk explain bynk.within.outside_handler shows the same from the installed toolchain, without a network.