How to Make `runPromise` Throw Raw Errors in Effect Typescript

hi folks
is it possible to let
runPromise
to throw raw error
currently I use runPromiseExit
then in onFailure case I use Cause.squash to extract raw error then I throw from there
here is my example code

    const exit = await Effect.gen(function* () {
      const svc = yield* TaskService
      const data = yield* svc.getById(input.params.taskId)
      return data
    }).pipe(
      Effect.catchTags({
        "NoSuchElementException": error => Effect.fail(new ORPCError("NOT_FOUND", { data: error, message: "not found" })),
        "ParseError": () => Effect.fail(new ORPCError("INTERNAL_SERVER_ERROR", { message: "parse data into schema error" })),
        "Task/GetById/Error": () => Effect.fail(new ORPCError("INTERNAL_SERVER_ERROR", { message: "get by id error" })),
      }),
      AppRuntime.runPromiseExit,
    )
    return Exit.match(exit, {
      onFailure: (error) => {
        const err = Cause.squash(error)
        throw err
      },
      onSuccess: data => data,
    })
Was this page helpful?