Hyperlinkv0.8.0-beta.28

Cron

Cron.CronParseErrorclasseffect/Cron.ts:487
CronParseError

Represents an error that occurs when parsing a cron expression fails.

When to use

Use to handle invalid cron expression failures returned by parse.

Details

This error provides information about what went wrong during parsing, including the error message and optionally the input that caused the error.

Example (Handling cron parse failures)

import { Cron, Result } from "effect"

const result = Cron.parse("invalid expression")
if (Result.isFailure(result)) {
  const error: Cron.CronParseError = result.failure
  console.log(error.message) // "Invalid number of segments in cron expression"
  console.log(error.input) // "invalid expression"
}
Source effect/Cron.ts:4876 lines
export class CronParseError extends Data.TaggedError("CronParseError")<{
  readonly message: string
  readonly input?: string
}> {
  readonly [CronParseErrorTypeId]: typeof CronParseErrorTypeId = CronParseErrorTypeId
}
Referenced by 3 symbols