bynk.exec.unavailable
Error A call to, or reference to, a function that hands work to the execution context (detach, within or race, directly or through the functions it calls) appears where no execution context exists: an agent handler, a WebSocket handler or a provider operation.
A function that uses detach, within or race hands work to the execution context, which a service handler has. An agent handler, a WebSocket handler, a provider operation, a function that is not effectful and a const, store or predicate initialiser do not. Calling such a function from one of those, directly or through other functions, or naming it as a value, is refused. The note gives the chain of calls down to the construct. Make the call in a service handler, and pass what it returns on.
Example
fn bounded(e: Effect[Int]) -> Effect[Bool] { … }
agent Counter { key id: String store n: Cell[Int] = 0
on call check() -> Effect[Bool] { bounded(Effect.pure(1)) // ✗ an agent handler has no execution context }}
service api { on call() -> Effect[Bool] by Caller { bounded(Effect.pure(1)) // ✓ a service handler has }}In the Book
See also
- Every code in its category, Other, on the diagnostic index.
bynk explain bynk.exec.unavailableshows the same from the installed toolchain, without a network.