Skip to content

SchemaError

2 exports Added in v4.0.0 Source

Errors

SchemaError

Added in v4.0.0 Source

Error thrown (or returned as the error channel value) when schema decoding or encoding fails.

Details

The issue field contains a structured Issue tree describing every validation failure, including the path to the problematic value and the expected type or constraint. Built-in issues have no actual field, and built-in messages do not include the rejected value. Other Issue fields and custom annotations or messages are not sanitized. message renders the issue tree as a human-readable string.

Use isSchemaError to narrow an unknown value to SchemaError.

Signature

declare class SchemaError extends YieldableError<this> & {
  readonly _tag: "SchemaError";
} & Readonly<{
  readonly issue: Issue;
}> {
  constructor(issue: Issue);
  readonly "~effect/SchemaError/SchemaError": "~effect/SchemaError/SchemaError";
  message: string;
  toString(): string;
}

Guards

Returns true if u is a SchemaError.

Signature

declare function isSchemaError(u: unknown): u is SchemaError;