Adding Derived Client Errors to an Either in Effect TypeScript

How can you add the derived client errors to an either? Right now I am catching them but I'd like to encode them in my either schema so other services are fully aware of all possible errors so they can react accordingly.
        const recovered = program.pipe(
            Effect.catchTags({
                RequestError: Effect.die,
                ResponseError: Effect.die,
                HttpApiDecodeError: Effect.die,
                ParseError: Effect.die,

            }),            
        );

        return Effect.runPromise(
            Effect.map(Effect.either(recovered), Schema.encodeSync(MyResult)),
        );
    }

Id like my either schema to look something like this:
export const MyResult = S.Either({
    left: S.Union(...existingErrors, RequestError, ResponseError, HttpApiDecodeError, ParseError),
    right: MySuccess,
});
Was this page helpful?