3 ms·
One of the nice things is that you can just let async functions fail and they won’t throw asynchronously and kill the process. So no, error handling isn’t impor
by minitech 9y ago
One of the nice things is that you can just let async functions fail and they won’t throw asynchronously and kill the process. So no, error handling isn’t important to include in a small example.
- NoInkling 9y agoPreviously that characteristic was also a massive pain point for debugging Node apps though - neglecting error handling would result in silently swallowed errors and leave people (particularly newbies) scratching their heads. Then they added unhandled rejection warnings by default, and all was ok again - but I see why someone might insist that all examples have error handling.
- minitech 9y agoThat’s not something that should be handled inside an async function (and therefore not in this example). If you don’t want to continue a promise chain, terminate it: .catch(error => { process.nextTick(() => { throw error; }); })
- partycoder 9y agoYou want to use setImmediate rather than process.nextTick.
- minitech 9y agoMmm… no, I didn’t want to. Why do you say that?