`bynk.cron.*` errors
cron handlers run on a schedule and have a fixed shape: at most one Int
parameter (the scheduled time), a five-field schedule, and an
Effect[Result[(), E]] return. These are the common errors when that shape is
broken.
bynk.cron.bad_params
Section titled “bynk.cron.bad_params”[bynk.cron.bad_params] an `from cron` parameter must be `Int` (the scheduled time in epoch milliseconds)Cause: a cron handler declared more than one parameter, or a single
parameter that isn’t Int. A scheduled trigger’s only input is the time it
fired.
Fix: take either no parameter or a single Int (the scheduled time, Unix
epoch milliseconds). Wrap it in your own time type inside the body if you want
stronger typing.
bynk.cron.invalid_schedule
Section titled “bynk.cron.invalid_schedule”[bynk.cron.invalid_schedule] cron expression `every day` must have exactly five whitespace-separated fieldsCause: the schedule string is not a five-field cron expression.
Fix: write five fields — minute hour day-of-month month day-of-week. For
example, "0 0 * * *" (midnight daily) or "*/15 * * * *" (every 15 minutes).
bynk.cron.return_not_effect_result
Section titled “bynk.cron.return_not_effect_result”[bynk.cron.return_not_effect_result] cron handler must return `Effect[Result[(), E]]`Cause: the return type isn’t Effect[Result[(), E]] — the Ok payload must
be unit ().
Fix: return Effect[Result[(), E]]; use Ok(()) on success and Err(e) on
a domain failure.
Other cron errors
Section titled “Other cron errors”bynk.cron.duplicate_schedule— two cron handlers in the context declare the same schedule. Give each a distinct expression.bynk.parse.cron_in_agent—from cronwas placed in anagent. Scheduled tasks belong in aservice.
Related
Section titled “Related”- Run a task on a schedule
- Reference: Cron