@remcostoeten/fync
Version:
A unified TypeScript library for easy access to popular APIs (GitHub, Spotify, GitLab, etc.)
30 lines • 969 B
TypeScript
import { BaseError } from "./index";
import type { TErrorContext, TRetryConfig } from "./types";
/**
* Centralized HTTP error handler with automatic retry logic
*/
export declare class HttpErrorHandler {
private retryConfig;
constructor(retryConfig?: Partial<TRetryConfig>);
/**
* Execute HTTP request with error handling and retry logic
*/
execute<T>(requestFn: () => Promise<T>, context: Partial<TErrorContext>): Promise<T>;
/**
* Handle a single HTTP error without retry logic
*/
handleError(error: unknown, context: Partial<TErrorContext>): Promise<BaseError>;
/**
* Sleep for specified milliseconds
*/
private sleep;
/**
* Check if an error is retryable based on current configuration
*/
isRetryable(error: BaseError): boolean;
/**
* Update retry configuration
*/
updateRetryConfig(config: Partial<TRetryConfig>): void;
}
//# sourceMappingURL=http-handler.d.ts.map