Hyperlinkv0.8.0-beta.28

Cron

Cron.isCronParseErrorconsteffect/Cron.ts:528
(u: unknown): u is CronParseError

Checks whether a given value is a CronParseError instance.

When to use

Use to narrow an unknown failure before handling it as a cron parse error.

Details

This function is a type guard that determines whether the provided value is a CronParseError by checking for the presence of the CronParseError type identifier.

Example (Checking cron parse errors)

import { Cron, Result } from "effect"

const result = Cron.parse("invalid cron expression")
if (Result.isFailure(result)) {
  const error = result.failure
  console.log(Cron.isCronParseError(error)) // true
}

console.log(Cron.isCronParseError(new Error("regular error"))) // false
console.log(Cron.isCronParseError("not an error")) // false
Source effect/Cron.ts:5281 lines
export const isCronParseError = (u: unknown): u is CronParseError => hasProperty(u, CronParseErrorTypeId)