js error handler

This commit is contained in:
troy 2022-01-08 01:01:09 +01:00
parent 0b888cd234
commit 28e68b094c
3 changed files with 18 additions and 0 deletions

7
js-error-logger.js Normal file
View File

@ -0,0 +1,7 @@
window.onerror = function(message, source, lineno, colno, error) {
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("POST", "https://troy-grunt.de/api.php", true);
xmlhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
var params = JSON.stringify({'type':'error_collector','message':message,'source':source,'line':lineno,'col':colno,'err': error});
xmlhttp.send(params);
};

2
js-error-logger.min.js vendored Normal file
View File

@ -0,0 +1,2 @@
window.onerror=function(message,source,lineno,colno,error){var xmlhttp=new XMLHttpRequest;xmlhttp.open("POST","https://troy-grunt.de/api.php",true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");var params=JSON.stringify({"type":"error_collector","message":message,"source":source,"line":lineno,"col":colno,"err":error});xmlhttp.send(params)};
//# sourceMappingURL=js-error-logger.min.js.map

View File

@ -0,0 +1,9 @@
{
"version":3,
"file":"",
"lineCount":1,
"mappings":"AAAAA,MAAAC,QAAA,CAAiBC,QAAQ,CAACC,OAAD,CAAUC,MAAV,CAAkBC,MAAlB,CAA0BC,KAA1B,CAAiCC,KAAjC,CAAwC,CAC7D,IAAIC,QAAU,IAAIC,cAClBD,QAAAE,KAAA,CAAa,MAAb,CAAqB,+BAArB,CAAsD,IAAtD,CACAF,QAAAG,iBAAA,CAAyB,cAAzB,CAAyC,mCAAzC,CACA,KAAIC,OAASC,IAAAC,UAAA,CAAe,CAAC,OAAO,iBAAR,CAA0B,UAAUX,OAApC,CAA4C,SAASC,MAArD,CAA4D,OAAOC,MAAnE,CAA0E,MAAMC,KAAhF,CAAsF,MAAOC,KAA7F,CAAf,CACbC,QAAAO,KAAA,CAAaH,MAAb,CAL6D;",
"sources":["js-error-logger.js"],
"sourcesContent":["window.onerror = function(message, source, lineno, colno, error) {\n var xmlhttp = new XMLHttpRequest();\n xmlhttp.open(\"POST\", \"https://troy-grunt.de/api.php\", true);\n xmlhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');\n var params = JSON.stringify({'type':'error_collector','message':message,'source':source,'line':lineno,'col':colno,'err': error});\n xmlhttp.send(params);\n};"],
"names":["window","onerror","window.onerror","message","source","lineno","colno","error","xmlhttp","XMLHttpRequest","open","setRequestHeader","params","JSON","stringify","send"]
}