This doesn't work:
fn((state => {
fn()(state).catch((error, state) => state)
})
The promise in the nested operation isn't compiled. so the catch isn't fed the state object
There could be two things at play here:
- That extra function call in
fn()(state).catch() is likely to be violating the compiler's expectations
- I think promises are only compiled top level? We don't really have any business compiling code in a callback like this. We don't know if passing state is appropriate - usually it's not
See Hunter's use case