Tutorial by Examples

Node.js has 3 basic ways to handle exceptions/errors: try-catch block error as the first argument to a callback emit an error event using eventEmitter try-catch is used to catch the exceptions thrown from the synchronous code execution. If the caller (or the caller's caller, ...) used try/ca...
Because Node.js runs on a single process uncaught exceptions are an issue to be aware of when developing applications. Silently Handling Exceptions Most of the people let node.js server(s) silently swallow up the errors. Silently handling the exception process.on('uncaughtException', functio...
Promises handle errors differently to synchronous or callback-driven code. const p = new Promise(function (resolve, reject) { reject(new Error('Oops')); }); // anything that is `reject`ed inside a promise will be available through catch // while a promise is rejected, `.then` will not be ...

Page 1 of 1