Managing Errors
In this lesson, we learn how to manage and cater to errors that arise in JavaScript code. Let's begin!
We'll cover the following...
Preventing and handling errors is a topic that deserves a full book dedicated to it. Here, I give you a brief overview and some useful advice.
Preventing and handling errors
You must have an error-handling strategy for the JavaScript layer of a web application, because any JavaScript error can cause a web page to become unusable. The basis of this strategy should be understanding when and why errors occur. Most users are not technical and can easily get confused when something doesn’t work as expected. In most cases when they face an error, they reload the page or try to navigate away and then back. If the problem does not get fixed after their attempts, they get frustrated and stop using your app.
As the developer, you should create robust applications that prevent users from making ...