effect-io-ai

Package: effect
Module: Cause

Cause.IllegalArgumentError

An error indicating that a function received an argument that violates its contract (e.g. negative where positive was expected).

Details

Implements YieldableError.

Example (Creating and checking an IllegalArgumentError)

import { Cause } from "effect"

const error = new Cause.IllegalArgumentError("Expected positive number")
console.log(error._tag)    // "IllegalArgumentError"
console.log(error.message) // "Expected positive number"

Signature

export interface IllegalArgumentError extends YieldableError {
  readonly [IllegalArgumentErrorTypeId]: typeof IllegalArgumentErrorTypeId
  readonly _tag: "IllegalArgumentError"
}

Source

Since v4.0.0