UNPKG

expo-finance-kit

Version:

Native Expo module for Apple FinanceKit - Access financial data from Apple Card and other accounts

58 lines 2.07 kB
/** * Error handling utilities for Expo Finance Kit * Provides consistent error creation and handling */ import { FinanceKitError, FinanceKitErrorCode } from '../ExpoFinanceKit.types'; /** * Creates a FinanceKit error with proper structure * @param code - Error code * @param message - Error message * @param details - Additional error details * @returns FinanceKitError */ export declare function createFinanceKitError(code: FinanceKitErrorCode, message: string, details?: Record<string, any>): FinanceKitError; /** * Checks if an error is a FinanceKit error * @param error - Error to check * @returns Boolean indicating if it's a FinanceKit error */ export declare function isFinanceKitError(error: any): error is FinanceKitError; /** * Gets user-friendly error message * @param error - Error to get message for * @returns User-friendly error message */ export declare function getUserFriendlyErrorMessage(error: any): string; /** * Wraps an async function with error handling * @param fn - Async function to wrap * @returns Wrapped function with error handling */ export declare function withErrorHandling<T extends (...args: any[]) => Promise<any>>(fn: T): T; /** * Logs error with context * @param error - Error to log * @param context - Additional context */ export declare function logError(error: any, context?: string): void; /** * Error recovery strategies */ export declare const ErrorRecovery: { /** * Retries a function with exponential backoff * @param fn - Function to retry * @param maxRetries - Maximum number of retries * @param initialDelay - Initial delay in milliseconds * @returns Result of the function */ retry<T>(fn: () => Promise<T>, maxRetries?: number, initialDelay?: number): Promise<T>; /** * Provides a fallback value if function fails * @param fn - Function to try * @param fallback - Fallback value * @returns Result of function or fallback */ fallback<T>(fn: () => Promise<T>, fallback: T): Promise<T>; }; //# sourceMappingURL=errors.d.ts.map