// ets_tracing: off import type { Cause } from "../Cause/cause.js" import { foldCauseM_, halt, succeed } from "./core.js" import type { Effect } from "./effect.js" /** * Returns an effect with its full cause of failure mapped using * the specified function. This can be used to transform errors * while preserving the original structure of Cause. */ export function mapErrorCause_( self: Effect, f: (cause: Cause) => Cause, __trace?: string ) { return foldCauseM_(self, (c) => halt(f(c)), succeed, __trace) } /** * Returns an effect with its full cause of failure mapped using * the specified function. This can be used to transform errors * while preserving the original structure of Cause. */ export function mapErrorCause( f: (cause: Cause) => Cause, __trace?: string ) { return (self: Effect) => foldCauseM_(self, (c) => halt(f(c)), succeed, __trace) }