4 ms·
in latest nodejs there is no a single place to catch exceptions in promise chain, which is very inconvenient.
by chj 9y ago
in latest nodejs there is no a single place to catch exceptions in promise chain, which is very inconvenient.
- maktouch 9y agoCould you explain this? We use node everyday and I don't understand what you mean.
- Xeoncross 9y agoNot sure what you are talking about: Promise.resolve().then(() => Promise.resolve().then(() => {throw new Error('Problem')})).catch((e) => console.log(e.message));
- always_good 9y agoThat doesn't make sense. That's one of the purposes of promises. The only escape hatch is to throw asynchronously which you just don't do.
- leetbulb 9y agoI have many large applications running on NodeJS 9.3.0 that rely on exceptions in promises for both control flow and error logging...no issues here.