ConstFaildToValidateError is created via failure("FailedToValidate") and is
thrown when a value does not conform to the provided Valibot schema. The
original Valibot error is available via the cause property.
Can be caught with catchTags using the "FailedToValidate" key.
import { pipe, catchTags, succeed, run } from "mini-effect";
import { validate, object, string } from "mini-effect/schema";
const User = object({ name: string() });
const result = await run(
pipe(
validate(User)({ name: 123 }),
catchTags({
FailedToValidate: (e) => succeed({ name: "fallback" }),
}),
),
);
A tagged error class for validation failures.