class SchedulerUnavailableError
extends Error
Since 0.2.0

Thrown when SchedulerPlugin is registered on a runtime whose platform cannot run its timers.

Cloudflare Workers evicts the isolate between invocations, so the setTimeout/setInterval arming the whole scheduler surface rests on never fires: an every or delay job registered there is silent forever. The replacement is the platform's own Cron Triggers, driven by WorkersCron from @setu-ts/cloudflare-plugin.

Examples

Example 1

try {
  app.register(SchedulerPlugin());
} catch (error) {
  if (error instanceof SchedulerUnavailableError) {
    // fall back to WorkersCron + `[triggers] crons`
  }
}

Constructors

SchedulerUnavailableError(platform: string)

Constructs the error, carrying the platform identifier for branching.

Parameters
platform: string

The offending runtime platform identifier

Properties

readonly
platform: string

The platform the plugin refused to register on.

Usage

import { SchedulerUnavailableError } from "scheduler-plugin/src/index.ts";