import * as tsplus_module_1 from "@effect/core/io/Effect/operations/failCauseNow";
import * as tsplus_module_2 from "@effect/core/io/Effect/operations/zipRight";
import * as tsplus_module_3 from "@effect/core/io/Cause/operations/failureTraceOrCause";
import * as tsplus_module_4 from "@tsplus/stdlib/data/Either/fold";
import * as tsplus_module_5 from "@effect/core/io/Effect/operations/succeedNow";
import * as tsplus_module_6 from "@effect/core/io/Effect/operations/foldCauseEffect";
/**
 * A version of `tapError` that gives you the trace of the error.
 *
 * @tsplus fluent ets/Effect tapErrorTrace
 */

export function tapErrorTrace_(self, f, __tsplusTrace) {
  return tsplus_module_6.foldCauseEffect_(self, cause => tsplus_module_4.fold_(tsplus_module_3.failureTraceOrCause(cause), ({
    tuple: [_, trace]
  }) => tsplus_module_2.zipRight_(f(trace), () => tsplus_module_1.failCauseNow(cause, __tsplusTrace), __tsplusTrace), () => tsplus_module_1.failCauseNow(cause, __tsplusTrace)), tsplus_module_5.succeedNow, __tsplusTrace);
}
/**
 * A version of `tapError` that gives you the trace of the error.
 *
 * @tsplus static ets/Effect/Aspects tapErrorTrace
 */

export const tapErrorTrace = (f, __tsplusTrace) => self => tapErrorTrace_(self, f, __tsplusTrace);
//# sourceMappingURL=tapErrorTrace.mjs.map