@lucidlayer/babel-plugin-traceform
Version:
Babel plugin to inject data-traceform-id attributes into React components for Traceform
34 lines (33 loc) • 1.4 kB
TypeScript
/**
* Traceform Central Error Handling Utilities for Babel Plugin
* Implements the TraceformError interface, error code scheme, and central handler.
* See memory_docs/codeMap_root.md and components_index.yaml for documentation.
*
* Error Code Format: TF-BABEL-[ERRNO] (e.g., TF-BABEL-001)
* All errors should use this structure and be routed through handleTraceformError.
* I18N and telemetry hooks are stubbed for future implementation.
*/
export interface TraceformError {
code: string;
message: string;
details?: any;
i18nKey?: string;
telemetry?: boolean;
}
/**
* Central error handler for all Traceform tools.
* Logs, surfaces to UI/DevTools, and triggers telemetry/I18N hooks as needed.
*
* @param error - TraceformError object
* @param context - Optional context (component, step, etc.)
*/
export declare function handleTraceformError(error: TraceformError, context?: string): void;
/**
* Utility to create a TraceformError with standard fields.
* @param code - Error code (TF-BABEL-[ERRNO] for Babel Plugin)
* @param message - User-facing or log message
* @param details - Optional details (stack, context, etc.)
* @param i18nKey - Optional I18N key
* @param telemetry - Flag for telemetry reporting
*/
export declare function createTraceformError(code: string, message: string, details?: any, i18nKey?: string, telemetry?: boolean): TraceformError;