I am currently working on a site that includes javascript code that we get from several different sources and need to run on the site I maintain. Every once and a while some of this code breaks without our knowing until its too late. Is there a monitoring tool that will crawl our site and look for javascript errors and report them or could this be incorporated into a selenium test somehow?
Share
On the sites I develop, I wrap everything in
try ... catchblocks, and if the exceptions I catch cannot be handled, I always generate an AJAX request to a script which emails an error report to the development team with as much information as I can gather.If the code is code you didn’t write yourself and
try...catchblocks would be difficult to add, you can use the window.onerror handler instead: