/** * Returns an effect with its error channel mapped using the specified * function. This can be used to lift a "smaller" error into a "larger" error. * * @tsplus static effect/core/io/Effect.Aspects mapError * @tsplus pipeable effect/core/io/Effect mapError */ export function mapError(f: (e: E) => E2) { return (self: Effect): Effect => self.foldCauseEffect( (cause) => cause.failureOrCause.fold((e) => Effect.failSync(f(e)), Effect.failCause), Effect.succeed ) }