unified-error-handling
Version:
A lightweight, zero-dependency error handling library with dynamic adapter loading for multiple error tracking services
28 lines • 1.41 kB
TypeScript
import { type DependencyList } from 'react';
import type { ErrorContext, NormalizedError } from '../store/types';
export declare function useErrorStore(): {
captureError: (error: Error | string, additionalContext?: Partial<ErrorContext>) => void;
captureMessage: (message: string, level?: string) => void;
setUser: (user: import("../store/types").UserContext | null) => void;
setContext: (context: Partial<ErrorContext>) => void;
addBreadcrumb: (breadcrumb: Omit<import("../store/types").Breadcrumb, "timestamp">) => void;
clearBreadcrumbs: () => void;
useAdapter: (name: string, config?: any) => Promise<void>;
removeAdapter: (name: string) => void;
flush: () => Promise<void>;
reset: () => void;
initialized: boolean;
offline: boolean;
activeAdapter: string | null;
};
export declare function useErrorHandler(): (error: Error | string, context?: Partial<ErrorContext>) => void;
export declare function useAsyncError(): (error: Error | string) => void;
export declare function useErrorTracking(componentName: string): void;
export declare function useAsyncOperation<T>(operation: () => Promise<T>, deps?: DependencyList): {
data: T | null;
loading: boolean;
error: Error | null;
execute: () => Promise<T>;
};
export declare function useErrorListener(callback: (error: NormalizedError) => void): void;
//# sourceMappingURL=hooks.d.ts.map