multitude
Version:
Comprehensive streams for push and pull
27 lines (26 loc) • 925 B
TypeScript
import { Push } from "../../../definitions";
export interface CatchesOptions<T, U> {
/**
* Errors will only be catched once by default,
* but `selector` can be made to be called recursively
* by setting a higher than 1 limit.
*/
limit?: number;
/**
* See `CatchesSelector`.
*/
selector?: CatchesSelector<T, U>;
}
/**
* Should return an observable for `catches`
* to continue the stream with.
*/
export declare type CatchesSelector<T, U> = (err: Error, observable: Push.Observable<T>) => Push.Convertible<U>;
/**
* Catches an error in the original observable
* and continues the stream by asynchronously subscribing
* to the Observable returned by `selector`.
* When no `selector` is provided, the original observable
* will be resubscribed.
*/
export declare function catches<T, U = T>(selector?: CatchesSelector<T, U> | CatchesOptions<T, U>): Push.Operation<T, T | U>;