import { ValitaError } from "https://deno.land/x/valita@v0.3.5/mod.ts";
An error type representing one or more validation/parsing errors.
The .message
property gives a short overview of the encountered issues,
while the .issue
property can be used to get a more detailed list.
Examples
Example 1
Example 1
const t = v.object({ a: v.null(), b: v.null() });
try {
t.parse({ a: 1 });
} catch (err) {
err.message;
// "invalid_type at .a (expected null) (+ 1 other issue)"
err.issues;
// [
// { code: 'invalid_type', path: [ 'a' ], expected: [ 'null' ] },
// { code: 'missing_value', path: [ 'b' ] }
// ]
}