effect-io-ai

Package: effect
Module: Effect

Effect.tryMapPromise

Returns an effect that maps its success using the specified side-effecting try function, converting any promise rejections into typed failed effects using the catch function.

An optional AbortSignal can be provided to allow for interruption of the wrapped Promise API.

See

Signature

declare const tryMapPromise: { <A, B, E1>(options: { readonly try: (a: A, signal: AbortSignal) => PromiseLike<B>; readonly catch: (error: unknown) => E1; }): <E, R>(self: Effect<A, E, R>) => Effect<B, E1 | E, R>; <A, E, R, B, E1>(self: Effect<A, E, R>, options: { readonly try: (a: A, signal: AbortSignal) => PromiseLike<B>; readonly catch: (error: unknown) => E1; }): Effect<B, E | E1, R>; }

Source

Since v2.0.0