mollitia
Version:
JavaScript Resilience Library
27 lines (25 loc) • 859 B
TypeScript
import { Module, ModuleOptions } from './index.js';
import { Circuit, CircuitFunction } from '../circuit.js';
type FallbackFunction = (...params: any[]) => any;
/**
* Properties that customizes the fallback behavior.
*/
export declare abstract class FallbackOptions extends ModuleOptions {
/**
* The callback, called when the circuit rejects, can be used to reject another error.
*/
callback: FallbackFunction;
}
/**
* The Fallback Module, that allows to filter errors.
*/
export declare class Fallback extends Module {
/**
* The callback, called when the circuit rejects, can be used to reject another error.
*/
callback: FallbackFunction;
constructor(options?: FallbackOptions);
execute<T>(circuit: Circuit, promise: CircuitFunction, ...params: any[]): Promise<T>;
private _promiseFallback;
}
export {};