Home › Node.js Tutorial › Node.js errors
Node.js errors
Handle problems safely.
Wrap risky code in try and catch. The error object has a name and a message. Uncaught errors stop the program.
Example code
try {
JSON.parse("{bad");
} catch (e) {
console.log(e.name);
}