import * as tsplus_module_1 from "@effect/core/io/Effect/operations/dieNow";
import * as tsplus_module_2 from "@effect/core/io/Effect/operations/runtime";
import * as tsplus_module_3 from "@effect/core/io/Effect/operations/flatMap";
import * as tsplus_module_4 from "@effect/core/io/Effect/operations/succeedNow";
import * as tsplus_module_5 from "@effect/core/io/Effect/operations/foldEffect";
/**
 * Recovers from all non-fatal defects.
 *
 * @tsplus fluent ets/Effect catchNonFatalOrDie
 */

export function catchNonFatalOrDie_(self, f, __tsplusTrace) {
  return tsplus_module_5.foldEffect_(self, e => tsplus_module_3.flatMap_(tsplus_module_2.runtime(__tsplusTrace), runtime => runtime.runtimeConfig.value.fatal(e) ? tsplus_module_1.dieNow(e, __tsplusTrace) : f(e), __tsplusTrace), tsplus_module_4.succeedNow, __tsplusTrace);
}
/**
 * Recovers from all non-fatal defects.
 *
 * @tsplus static ets/Effect/Aspects catchNonFatalOrDie
 */

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