Introduction

Recently in one of my projects, I’m informed by my QA team
that, in some pages they?re experiencing crashes, or some pages not functioning
properly after sometime.

Our team looked for options where there can be a code
generating errors. And the feedback I got, from the QA team was not helpful to
reproduce the error. But there is no doubt to look for areas only in JavaScript
coding, and not other than JavaScript coding.

Normally while releasing a project, what I would do is, just
escape/bypass the JavaScript errors. That means, whenever there is a JavaScript
error, it will not be reported to the user and they are suppressed.

Background

Following is the function, we can normally use to suppress the JavaScript errors.

var isDebugging = true;
function ErrorSetting(msg, file_loc, line_no) {
    var e_msg=msg;
    var e_file=file_loc;
    var e_line=line_no;
    var error_d = "Error in file: " + file_loc +
                          "\nline number:" + line_no +
                           "\nMessage:" + msg;
    if(isDebugging)
        alert("Error Found !!!\n--------------\n"+error_d);

     return true;
}
window.onerror = ErrorSetting;

window.onerror = ErrorSetting; this line will call the ‘ErrorSetting’
function, whenever there is a JavaScript error. And the function will return
true. So the user will not get JavaScript
error notifications and won’t be
annoyed. Read the rest of this entry »