import type { StandardSchemaV1 } from "./standard-schema.ts"; /** * @name Structure.Error * @group Structure * * An error produced from processing a value for a {@link Structure} * * ```js * const error = new Structure.Error("Expected something", ["some", "path"]) * ``` * * It takes a `message`, `path` & `children` in the constructor. * * You can also iterate over a Structure.Error to walk the tree of errors. * * ```js * for (const error2 of error) { * console.log(error2.getOneLiner()) * } * ``` */ export declare class _StructError extends Error { path: string[]; children: _StructError[]; constructor(message: string, path?: string[], children?: _StructError[]); /** * @internal * * Create a new error with the context added to it * * ```js * const nested = Structure.Error.chain( * new Error("Something went wrong"), * ["some", "path"] * ) * ``` */ static chain(error: unknown, context: { path: string[]; }): _StructError; static chain(error: unknown, path: string[]): _StructError; /** * Get a single-line variant, describing the error * * ```js * error.getOneLiner() * ``` * * which outputs something like: * * ``` * some.path — expected a number * ``` */ getOneLiner(): string; /** * Loop through child errors including the error itself */ [Symbol.iterator](): Iterator<_StructError>; /** * Generate a human-friendly string describing the error and all nested errors * * ```js * error.toFriendlyString() * ``` * * which outputs something like: * * ``` * Object does not match schema * name — expected a string * age — expected a number * ``` */ toFriendlyString(): string; /** * Convert the error to a [StandardSchema](https://standardschema.dev/) issue to be used with that ecosystem. */ getStandardSchemaIssues(): StandardSchemaV1.Issue[]; } /** @deprecated use {@link Structure.Error} */ export declare const StructError: typeof _StructError; /** @deprecated use {@link Structure.Error} */ export type StructError = _StructError; /** @deprecated use {@link Structure.Error} */ export declare const StructureError: typeof _StructError; /** @deprecated use {@link Structure.Error} */ export declare const StructuralError: typeof _StructError; /** @deprecated use {@link Structure.Error} */ export type StructuralError = _StructError; //# sourceMappingURL=struct-error.d.ts.map