Interface AsyncPoolOptions<Item>

interface AsyncPoolOptions<Item> {
    limit?: number;
    onError?: (
        item: Item,
        index: number,
        error: unknown,
    ) => MaybePromise<"ignore" | "collect" | "throw">;
    signal?: AbortSignal;
}

Type Parameters

  • Item

Properties

limit?: number

Concurrency limit

16
onError?: (
    item: Item,
    index: number,
    error: unknown,
) => MaybePromise<"ignore" | "collect" | "throw">

Customize the behavior when an error is thrown in the iterator.

  • ignore - Ignore the error and continue
  • collect - Collect the error and throw it at the end in an AggregateError
  • throw - Throw the error immediately, and stop any other pending tasks

() => 'throw'

signal?: AbortSignal

Abort signal