Skip to content
Playground(another site)

bynk.cron.return_not_effect_result

Error A cron handler does not return Effect[Result[(), E]].

A cron run has no caller to hand a value to and no retry channel: Ok(()) completes the run silently and Err(e) logs e and completes. So the handler must return Effect[Result[(), E]], with () on the success side, for some error type E. Return Ok(()) when the work is done and map a failure to Err. The queue counterpart is bynk.queue.return_not_queue_result.

Example

on schedule("*/5 * * * *") () -> Effect[Result[Int, String]] { … } // ✗ a cron run has nowhere to put an `Int`
on schedule("*/5 * * * *") () -> Effect[Result[(), String]] { … } // ✓ unit on success

In the Book

See also

  • The grammar rule it governs: cron_handler.
  • Every code in its category, Cron, on the diagnostic index.
  • bynk explain bynk.cron.return_not_effect_result shows the same from the installed toolchain, without a network.