How to find JavaScript errors

How to find JavaScript errors

Are you a webmaster who runs a JavaScript heavy website? Are you 100% sure you tracked and squashed all JavaScript bugs? If you are not, than just keep reading.

Getting all JavaScript to work perfectly across all browsers is extremely challenging and time consuming. It is not possible to test every single page on your site in any possible environment (different browsers, mobile clients, different OS’s). It would take you too much time and you can still miss some issues.

How to solve this problem?

Automated JavaScript error logging is the answer. Make your users test your website for, you just collect the error log and voila you have a sure way to squash those nasty JavaScript bugs. Find hidden bugs when a user stumbles on them, so the next user gets a bug free experience.

How to automate JavaScript error logging?

There are two ways to do this. There are several services that provide you with everything you need so you just install the script and follow the steps provided by the service provider. You usually get an admin panel where you can view all the errors, and some even offer email notifications when an error appears.  These services usually offer everything you need for JavaScript error tracking, often even more than that, but they are usually not free.

The other way to track JavaScript errors is to simply implement a simple solution yourself. Probably the best way to do this is to put all your JavaScript code into try catch blocks and catch all errors. When an error appears you just send the error message with as much information as possible to your server and log it somewhere or do some other action. In some cases you will want to be notified about it on email and in other cases you will just want to log it somewhere for later viewing.

Leave a Comment