import { BaseError, type TErrorMetadata } from '@pawells/typescript-common'; /** * React Shared error metadata type for error context. */ type TReactSharedErrorMetadata = TErrorMetadata & { readonly code: string; }; /** * Domain error class for `@pawells/react-shared` validation and runtime failures. * Extends {@link BaseError} to provide structured error classification and optional cause chain. * Every throw site in this package uses one of the codes in {@link ReactSharedError.Code}. * * @example * ```typescript * throw new ReactSharedError('Invalid color format provided', { code: ReactSharedError.Code.INVALID_COLOR }); * ``` */ export declare class ReactSharedError extends BaseError { /** * Enumeration of react-shared error codes for classification and debugging. * * - `INVALID_COLOR` — A color value passed to a Voronoi utility function was malformed * - `INVALID_OVERLAY_COLOR` — The `overlay` prop passed to `VoronoiBackground` is not a valid CSS color * - `INVALID_INACTIVITY_CONFIG` — `warningSeconds` was configured to be >= the computed timeout for `useInactivityWarning` * - `NOTIFICATION_CONTEXT_ERROR` — `useNotification` was called outside of a `NotificationProvider` */ static readonly Code: Readonly<{ readonly INVALID_COLOR: "INVALID_COLOR"; readonly INVALID_OVERLAY_COLOR: "INVALID_OVERLAY_COLOR"; readonly INVALID_INACTIVITY_CONFIG: "INVALID_INACTIVITY_CONFIG"; readonly NOTIFICATION_CONTEXT_ERROR: "NOTIFICATION_CONTEXT_ERROR"; }>; /** * Creates a new ReactSharedError instance with a code, message, and optional cause chain. * * @param message - Human-readable error message describing the failure * @param options - Configuration object * @param options.code - One of {@link ReactSharedError.Code} identifying the failure category * @param options.cause - Original error to chain for root cause analysis * * @example * ```typescript * throw new ReactSharedError('Invalid color format provided', { * code: ReactSharedError.Code.INVALID_COLOR * }); * * // With cause chain * try { * // attempt operation * } catch (originalError) { * throw new ReactSharedError('Notification context unavailable', { * code: ReactSharedError.Code.NOTIFICATION_CONTEXT_ERROR, * cause: originalError instanceof Error ? originalError : undefined * }); * } * ``` */ constructor(message: string, options: { code: (typeof ReactSharedError.Code)[keyof typeof ReactSharedError.Code]; cause?: Error; }); } export {}; //# sourceMappingURL=react-shared-error.d.ts.map