mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 07:56:16 -04:00
send client side javascript errors to the server
This commit is contained in:
parent
b58bdb4e4d
commit
c2457e06d8
2 changed files with 22 additions and 0 deletions
|
@ -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 /
|
//serve index.html under /
|
||||||
app.get('/', function(req, res)
|
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…
Add table
Add a link
Reference in a new issue