nodejs .catch error code example
Example 1: catch error message js
try {
// test code
} catch (error) { // if error
console.error(error); // return error
}
Example 2: node js catch any errors
process.on('uncaughtException', function(err) {
console.log('Caught exception: ' + err);
});