19 lines
654 B
JavaScript
19 lines
654 B
JavaScript
window.onerror = function(error, url, line, column, errorObj) {
|
|
if (error == 'TypeError: Attempted to assign to readonly property.') {
|
|
return;
|
|
}
|
|
try {
|
|
var stack = (errorObj && errorObj.stack) || "(no stack trace available)",
|
|
url = document.location.pathname + ' at ' + url,
|
|
text = url + "\n\nLine:" + line + "\n\n" + error + "\n\n" + stack;
|
|
logError(text);
|
|
} catch(e) {}
|
|
};
|
|
|
|
function logError(error) {
|
|
if (document.location.hostname == 'speedtrans.pad.ma') {
|
|
var request = new XMLHttpRequest();
|
|
request.open('post', '/error', true);
|
|
request.send(error);
|
|
}
|
|
}
|