UNPKG

@canard/schema-form

Version:

React-based component library that renders forms based on JSON Schema with plugin system support for validators and UI components

28 lines (27 loc) 1 kB
import { BaseError, type ErrorDetails } from '@winglet/common-utils/error'; /** * Error class for form submission validation errors. * * Thrown during the form submission process when validation fails. * This is separate from AJV validation errors and specifically handles * validation failures that occur in the onSubmit phase. * * Currently used for: * - Schema validation failures during form submission * * @remarks * Error details typically include: * - value: The form data that failed validation * - errors: Array of validation errors * - jsonSchema: The schema used for validation */ export declare class ValidationError extends BaseError { constructor(code: string, message: string, details?: ErrorDetails); } /** * Type guard to check if an error is a ValidationError instance. * * @param error - Error object to check * @returns Whether the error is a ValidationError instance */ export declare const isValidationError: (error: unknown) => error is ValidationError;