import * as tsplus_module_1 from "@effect/core/io/Effect/operations/succeed";
import * as tsplus_module_2 from "@effect/core/io/Effect/operations/failNow";
import * as tsplus_module_3 from "@effect/core/io/Effect/operations/suspendSucceed";
/**
 * Imports a synchronous side-effect into a pure value, translating any
 * thrown exceptions into typed failed effects.
 *
 * @tsplus static ets/Effect/Ops tryCatch
 */

export function tryCatch(attempt, onThrow, __tsplusTrace) {
  return tsplus_module_3.suspendSucceed(() => {
    try {
      return tsplus_module_1.succeed(attempt, __tsplusTrace);
    } catch (error) {
      return tsplus_module_2.failNow(onThrow(error), __tsplusTrace);
    }
  }, __tsplusTrace);
}
//# sourceMappingURL=tryCatch.mjs.map