is there a cleaner way to do this? i feel like i run into this a good amount where i want to transform the success value into in error in some specific cases. in this instance i have an Exit (which i read is preferred to use as a Result type over Either), so I don't have all the utils of an Effect
const active = active.pipe( Exit.flatMap((data) => { return data ? Exit.succeed(data) : Exit.fail(new InvalidWorkspaceError("No active workspace")); }), );
const active = active.pipe( Exit.flatMap((data) => { return data ? Exit.succeed(data) : Exit.fail(new InvalidWorkspaceError("No active workspace")); }), );