What is an unhandled exception mean?

What is an unhandled exception mean?

Generally an unhandled exception in your code means that your program is in a condition or state that you have not described to the computer how to handle that situation.

What does "node --unhandled-rejections=strict" mean?


node --unhandled-rejections=strict main.js

Sure good question!   Focus on the word *unhandled*   It means:   Normally , when an error happens (remember "errors" are also called "exceptions") then we handle them by doing : try:   //Do something catch A-Spesific-error:    // Handle the error The above is an example of a *handled* exception.   An *unhandled* except/error is when an error happens which we're not looking out for.   Normally it is best to handle *every* possible exception.   The default behaviour of nodejs is to *stop* when an exception/error happens which we have not handled. This is good, because   Imagine you're a bank, and an error happens which you weren't expecting, and the code continues! 😱that would be bad.   However, we are OK/happy for the tests to continue when an unhandled exception happens. So, we have to change the default nodejs behaviour.   Please ask any more questions about this, it's very useful/important because it helps write more stable software 🙂🙌

Some languages, like Rust and Scala force the programmer to always write code for bother the success, and possible failure case in your code. This might sound laborious, but actually it may lead to more stable code.  

Collect recurring payments with Subscribie - Try Now