I am new in fp-ts so please help me resolve my problem: I need to log the same error multiple times on different levels using asynchronous function. Here is my example code:
const myProgram = pipe(
tryCatch(() => someAsyncFunc(), toError),
mapLeft(async (err1) => {
await loggerAsyncFunc();
return err1;
}),
)
const main = pipe(
myProgram,
mapLeft((err2) => {
// err2 is a pending promise :(
})
)();
I am using mapLeft
to do that but it doesn't work.
What I need to do to have in err2
the value of the error (err1) instead of pending promise?