Skip to main content
Module

x/valita/mod.ts>err

A typesafe validation & parsing library for TypeScript.
Latest
function err
import { err } from "https://deno.land/x/valita@v0.3.8/mod.ts";

Create a value for returning a parsing error from chain().

An optional error message can be provided.

Examples

Example 1

const t = v.string().chain(() => v.err("bad value"));

t.parse("hello");
// ValitaError: custom_error at . (bad value)

Parameters

optional
error: CustomError