smart-saga-pattern
Version:
A library implementing the Saga pattern for microservice architecture
34 lines (33 loc) • 821 B
TypeScript
import { SagaLogger } from '../types';
/**
* Options for the ErrorHandler
*/
export interface ErrorHandlerOptions {
logger?: SagaLogger;
retryCount?: number;
retryDelay?: number;
}
/**
* Handles errors in the Saga system
*/
export declare class ErrorHandler {
private logger?;
private retryCount;
private retryDelay;
/**
* Creates a new ErrorHandler
* @param options Error handler options
*/
constructor(options?: ErrorHandlerOptions);
/**
* Executes a function with retry logic
* @param fn Function to execute
* @param context Context for error logging
*/
executeWithRetry<T>(fn: () => Promise<T>, context?: Record<string, any>): Promise<T>;
/**
* Creates a delay
* @param ms Milliseconds to delay
*/
private delay;
}