Node.js tutorial – error handling

The tutorial provides the detailing on the node.js errors being occurred while processing the application request. Like any other scripting language , the node.js error are also classified into the below given categories:

Standard Java Script Error : the below give errors can be considered as the node.js standard javaScript errors.

System Error: The System error could occur when the node.js program / function performs the file open operation where the file does not exist or trying to send request data through the socket which is closed , then the node.js throws the system error

Assertion Error: These types of error are initiated by Node.js when defects an logic violation which is not expected due to processing the request. The node.js assert module raises the error.

User-specified Error: These types of errors are custom error written in the application code.

Error-first callbacks

The node.js asynchronous API methods follows the common pattern referred as “error-first-callback”. The error-first-callback pattern , a callback function is passed to the method as an argument. In case of error, the callback function is called with the Error Object as the first argument. In case of No Error, the first argument is passed as Null.