init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
54
KretaWeb/Scripts/ErrorHandler.js
Normal file
54
KretaWeb/Scripts/ErrorHandler.js
Normal file
|
@ -0,0 +1,54 @@
|
|||
function GlobalErrorHandler(url) {
|
||||
this.url = url;
|
||||
|
||||
function logConsolError(e) {
|
||||
if (
|
||||
typeof console !== 'undefined' &&
|
||||
typeof console.error !== 'undefined'
|
||||
) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
window.onerror = function (msg, url, lineNo, columnNo, error) {
|
||||
try {
|
||||
var message = {};
|
||||
message.Message = msg;
|
||||
message.URL = url;
|
||||
message.Line = lineNo;
|
||||
message.Column = columnNo;
|
||||
message.Error = error;
|
||||
message.Agent = navigator.userAgent;
|
||||
|
||||
if (error && error.stack) {
|
||||
message.StackTrace = error.stack;
|
||||
}
|
||||
|
||||
if (
|
||||
message.Message == 'Unspecified error.' &&
|
||||
message.Line == 1 &&
|
||||
message.Column == 1
|
||||
) {
|
||||
return; /*IE dob egy hibát bezárásnál ha a consol fel volt nyitva.*/
|
||||
}
|
||||
var csrfToken = $("input[name='__RequestVerificationToken']").val();
|
||||
var stringData = JSON.stringify({ clientError: message });
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
headers: { 'X-Request-Verification-Token': csrfToken },
|
||||
url: this.url,
|
||||
data: stringData,
|
||||
async: true,
|
||||
cache: false,
|
||||
datatype: 'json',
|
||||
contentType: 'application/json; charset=utf-8',
|
||||
error: function (response) {
|
||||
logConsolError(msg);
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
logConsolError(e);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue