IllegalArgumentErrorAn 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"errors
Source effect/Cause.ts:152121 lines
export interface IllegalArgumentError extends YieldableError {
readonly [const IllegalArgumentErrorTypeId: "~effect/Cause/IllegalArgumentError"Unique brand for IllegalArgumentError.
IllegalArgumentErrorTypeId]: typeof const IllegalArgumentErrorTypeId: "~effect/Cause/IllegalArgumentError"Unique brand for IllegalArgumentError.
IllegalArgumentErrorTypeId
readonly IllegalArgumentError._tag: "IllegalArgumentError"_tag: "IllegalArgumentError"
}
/**
* Constructs an `IllegalArgumentError` with an optional message.
*
* **Example** (Creating an IllegalArgumentError)
*
* ```ts
* import { Cause } from "effect"
*
* const error = new Cause.IllegalArgumentError("Invalid argument")
* console.log(error.message) // "Invalid argument"
* ```
*
* @category constructors
* @since 4.0.0
*/
export const const IllegalArgumentError: new (
message?: string
) => 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"
Constructs an IllegalArgumentError with an optional message.
Example (Creating an IllegalArgumentError)
import { Cause } from "effect"
const error = new Cause.IllegalArgumentError("Invalid argument")
console.log(error.message) // "Invalid argument"
IllegalArgumentError: new(message: string | undefinedmessage?: string) => IllegalArgumentError = import effecteffect.class IllegalArgumentErrorIllegalArgumentErrorReferenced by 4 symbols