catching error
Hi,
I'm attemtping to catch, and ignore javascript errors... It works for certain messages, but others still get through. Could anyone help me out with this? I'm pulling data, and putting it to an Excel sheet, and Excel is very fragile which is why I want to ignore and continue... The one error message that seems to always get through is "Call was rejected by callee."
window.onerror = handleErrors
function handleErrors(msg, url, line)
{
createLog(msg,line);
return (true);
}
function createLog(msg,line)
{
var fs = new ActiveXObject("Scripting.FileSystemObject");
var path = getPath();
path += "\\logs\\" + timeStamp() + ".txt";
if (!fs.FileExists(path))
var a = fs.CreateTextFile(path, true);
else
var a = fs.OpenTextFile(path, 8, false);
for (i=0;i<appRunningArr.length;i++)
if (appRunningArr[i] == true)
{
runningApp += listAppArr[i] + " ";
restartApp(listAppArr[i]);
}
a.WriteLine("Error occured at: " + getTime());
a.WriteLine("Message: " + msg);
a.WriteLine("Line: " + line);
a.WriteLine("Running application(s): " + runningApp);
a.WriteLine("");
}
|