Try...catch and async code

In the Node.js course in the lesson on errors, it is stated “In order to understand why Node uses error-first callbacks in many of its asynchronous APIs, let’s demonstrate that traditional try...catch statements won’t work for errors thrown during asynchronous operations.”
However, in another lesson on async/await and handling errors, it is stated
" With async...await , we use try...catch statements for error handling. By using this syntax, not only are we able to handle errors in the same way we do with synchronous code, but we can also catch both synchronous and asynchronous errors."

It seems like the info is conflicting. Is it just that the Node.js course is out of date or am I misunderstanding something?

1 Like