It throws "Uncaught (in promise) Error" to the console every time, because then data is just - I have no chance to handle promise error... It there something like this:
return maybe.fromMaybe(
() => Promise.reject(new Error(/* ... */)), // <-- function instead of value
data
)
For example in scala -
maybe.getOrElse(new Error('...'))
argument will be executed only if maybe is nothing (call-by-name style (x: => Any))
Hello! I'm pretty new in fp, and I have some some misunderstanding how to resolve cases like this:
It throws "Uncaught (in promise) Error" to the console every time, because then data is just - I have no chance to handle promise error... It there something like this:
For example in scala -
argument will be executed only if maybe is nothing (call-by-name style (x: => Any))