Domain Module

A Node module called domain was introduced in Node 0.8.0 for handling errors. A domain module is like a flexible error handler for any and all errors that might be thrown within it. Using domains is the recommended method for handling uncaught errors in Node.

Note : The domain module is currently marked as Unstable, meaning, the API may change in the future.

What is a domain, exactly?
A domain is an EventEmitter object which, when “entered”, is accessible globally via process.domain and require(‘domain’).active. Multiple domains can exist in the domain stack, which is simply an array internally in Node holding all domains in the order they were created. Only one domain can be active on the process at a time, and is only active when it is “entered”. This is so that when Node.js is running code, it knows which domain should be notified about any unhandled errors that might occur.

About

My Name is Dileep Singh, Noder, Javascript Lover & NoSql Developer, Fitness Freak, Love to travel new places, learning photography & Music Manic ♯ ♩ ♬

Posted in Node.Js Tagged with: