Understanding `Effect.runPromise` and `Effect.tryPromise` Usage

I did not really understand
Effect.runPromise
. I'm trying to use it with Effect.tryPromise, but it says runPromise will reject when Effect fails. This basically does not let me pipe it out, but rather I have to go back to old async await and try/catch:
import { Effect } from "effect";

const fetchUser = (id: number) =>
    Effect.tryPromise({
        try: async (signal) => {
            const resp = await fetch(
                `https://jsonplaceholde.typicode.com/users/${id}`,
                {
                    signal,
                },
            );
            return resp;
        },
        catch: (error) => {},
    });

Effect.runPromise(
    fetchUser(1).pipe(
        Effect.tap((resp) => {
            console.log(resp);
        }),
    ),
);
Was this page helpful?