Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/superstruct/error.ts>StructError

A simple and composable way to validate data in JavaScript (and TypeScript).
Latest
class StructError
extends TypeError
import { StructError } from "https://deno.land/x/superstruct@v2.0.3-1/error.ts";

StructError objects are thrown (or returned) when validation fails.

Validation logic is design to exit early for maximum performance. The error represents the first error encountered during validation. For more detail, the error.failures property is a generator function that can be run to continue validation and receive all the failures in the data.

Constructors

new
StructError(failure: Failure, failures: () => Generator<Failure>)

Index Signatures

[x: string]: any

Properties

branch: Array<any>
failures: () => Array<Failure>
key: any
path: Array<any>
refinement: string | undefined
type: string
value: any