UNPKG

whatsapp-crm-common

Version:

Componentes compartidos para servicios de WhatsApp CRM - Common utilities and types for WhatsApp CRM system

62 lines 1.8 kB
/** * Custom error classes for repository operations * These errors provide better categorization and handling for database operations */ export declare class RepositoryError extends Error { readonly context: { tenantId?: string; agentId?: number; operation: string; details?: any; }; readonly isRetryable: boolean; readonly originalError?: Error; constructor(message: string, context: { tenantId?: string; agentId?: number; operation: string; details?: any; }, originalError?: Error, isRetryable?: boolean); /** * Creates a detailed error message with context */ getDetailedMessage(): string; /** * Gets context information for logging */ getLogContext(): Record<string, any>; } /** * Error for message-specific operations */ export declare class MessageRepositoryError extends RepositoryError { constructor(context: { tenantId?: string; agentId?: number; operation: string; messageId?: string; chatId?: string; details?: any; }, originalError?: Error, isRetryable?: boolean); } /** * Error for chat-specific operations */ export declare class ChatRepositoryError extends RepositoryError { constructor(context: { tenantId?: string; agentId?: number; operation: string; chatId?: string; details?: any; }, originalError?: Error, isRetryable?: boolean); } /** * Factory function to create appropriate error based on original error */ export declare function createRepositoryError(operation: string, context: { tenantId?: string; agentId?: number; details?: any; }, originalError: Error): RepositoryError; //# sourceMappingURL=repository-errors.d.ts.map