send client side javascript errors to the server
parent
b58bdb4e4d
commit
c2457e06d8
|
@ -312,6 +312,16 @@ async.waterfall([
|
|||
});
|
||||
});
|
||||
|
||||
//The Etherpad client side sends information about client side javscript errors
|
||||
app.post('/jserror', function(req, res)
|
||||
{
|
||||
new formidable.IncomingForm().parse(req, function(err, fields, files)
|
||||
{
|
||||
console.error("CLIENT SIDE JAVASCRIPT ERROR: " + fields.errorInfo);
|
||||
res.end("OK");
|
||||
});
|
||||
});
|
||||
|
||||
//serve index.html under /
|
||||
app.get('/', function(req, res)
|
||||
{
|
||||
|
|
|
@ -461,3 +461,15 @@ var padutils = {
|
|||
});
|
||||
}
|
||||
};
|
||||
|
||||
//send javascript errors to the server
|
||||
window.onerror = function test (msg, url, linenumber)
|
||||
{
|
||||
var errObj = {errorInfo: JSON.stringify({msg: msg, url: url, linenumber: linenumber, userAgent: navigator.userAgent})};
|
||||
var loc = document.location;
|
||||
var url = loc.protocol + "//" + loc.hostname + ":" + loc.port + "/" + loc.pathname.substr(1, loc.pathname.indexOf("/p/")) + "jserror";
|
||||
|
||||
$.post(url, errObj);
|
||||
|
||||
return false;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue