Skip to main content
Module

x/superstruct/error.ts>StructError

A simple and composable way to validate data in JavaScript (and TypeScript).
Go to Latest
class StructError
extends TypeError
import { StructError } from "https://deno.land/x/superstruct@v0.16.5/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