How do I handle exceptions globally with native promises in node.js?
问题 I know how to handle specific errors in promises but I sometimes have pieces of code that looks like this: somePromise.then(function(response){ otherAPI(JSON.parse(response)); }); Sometimes, I get invalid JSON which causes a silent failure here when JSON.parse throw s. In general I have to remember to add a .catch handler to every single promise in my code and when I don't I have no way to find out where I forgot one. How do I find these suppressed errors in my code? 回答1: In Modern NodeJS