Catching async errors from eval using domain
问题 I'm trying to catch async errors with the npm eval module. It's very similar to the normal eval, except it utilizes node's vm module directly. I just came across node's domain module. It allows me to catch async errors that occur within _eval . However I checked the documentation and I can't find a done event for domain. How am I supposed to know when to resolve the promise? var code = [ "setTimeout(function () {", " throw new Error('async error sim')", "}, 1000)" ].join('\n') var domain =