/** * Custom error types for captcha-canvas to provide actionable and typed error reporting. */ export type ErrorCode = 'VALIDATION_ERROR' | 'GENERATION_ERROR' | 'SECURITY_ERROR'; export interface ErrorDetails { param?: string; expected?: string; actual?: unknown; suggestion?: string; context?: Record; } export declare class CaptchaBaseError extends Error { readonly code: ErrorCode; readonly details?: ErrorDetails; constructor(message: string, code: ErrorCode, details?: ErrorDetails); } /** * Thrown when configuration/parameter validation fails. */ export declare class CaptchaValidationError extends CaptchaBaseError { constructor(message: string, details?: ErrorDetails); } /** * Thrown when rendering/generation fails (e.g., canvas/image errors). */ export declare class CaptchaGenerationError extends CaptchaBaseError { constructor(message: string, details?: ErrorDetails); } /** * Thrown when security-related constraints are violated. */ export declare class CaptchaSecurityError extends CaptchaBaseError { constructor(message: string, details?: ErrorDetails); }