0 points

try-catch? | Node.js


dashboard

Fri Nov 13 2020 04:59:44 GMT+0000 (UTC)

Posted by @mvieira #javascript

console.log("entering try-catch statement");

try {
  console.log("entering try block");
  throw "thrown message";
  console.log("this message is never seen");
}
catch (e) {
  console.log("entering catch block");
  console.log(e);
  console.log("leaving catch block");
}
finally {
  console.log("entering and leaving the finally block");
}

console.log("leaving try-catch statement");
content_copy Copy

https://nodejs.org/en/knowledge/errors/what-is-try-catch/