Node.js Best Practice Exception Handling

后端 未结 10 1456
遥遥无期
遥遥无期 2020-11-22 04:19

I just started trying out node.js a few days ago. I\'ve realized that the Node is terminated whenever I have an unhandled exception in my program. This is different than the

10条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-22 04:51

    After reading this post some time ago I was wondering if it was safe to use domains for exception handling on an api / function level. I wanted to use them to simplify exception handling code in each async function I wrote. My concern was that using a new domain for each function would introduce significant overhead. My homework seems to indicate that there is minimal overhead and that performance is actually better with domains than with try catch in some situations.

    http://www.lighthouselogic.com/#/using-a-new-domain-for-each-async-function-in-node/

提交回复
热议问题