|
|
|
@ -1,11 +1,16 @@
|
|
|
|
|
'use strict';
|
|
|
|
|
(function () {
|
|
|
|
|
define(
|
|
|
|
|
[
|
|
|
|
|
'jquery',
|
|
|
|
|
'messenger'
|
|
|
|
|
], function ($, Messenger) {
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
window.alert = function (message) {
|
|
|
|
|
window.Messenger().post(message);
|
|
|
|
|
new Messenger().post(message);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var addError = function (message) {
|
|
|
|
|
window.$('#errors').append('<div>' + message + '</div>');
|
|
|
|
|
$('#errors').append('<div>' + message + '</div>');
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
window.onerror = function (msg, url, line) {
|
|
|
|
@ -30,7 +35,7 @@
|
|
|
|
|
showCloseButton: true
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
window.Messenger().post(message);
|
|
|
|
|
new Messenger().post(message);
|
|
|
|
|
|
|
|
|
|
addError(message.message);
|
|
|
|
|
|
|
|
|
@ -38,13 +43,13 @@
|
|
|
|
|
catch (error) {
|
|
|
|
|
console.log('An error occurred while reporting error. ' + error);
|
|
|
|
|
console.log(msg);
|
|
|
|
|
window.alert('Couldn\'t report JS error. ' + msg);
|
|
|
|
|
new Messenger().post('Couldn\'t report JS error. ' + msg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false; //don't suppress default alerts and logs.
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
window.$(document).ajaxError(function (event, xmlHttpRequest, ajaxOptions) {
|
|
|
|
|
$(document).ajaxError(function (event, xmlHttpRequest, ajaxOptions) {
|
|
|
|
|
|
|
|
|
|
//don't report 200 error codes
|
|
|
|
|
if (xmlHttpRequest.status >= 200 && xmlHttpRequest.status <= 300) {
|
|
|
|
@ -78,11 +83,10 @@
|
|
|
|
|
message.message = '[{0}] {1} : {2}'.format(ajaxOptions.type, xmlHttpRequest.statusText, ajaxOptions.url);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
window.Messenger().post(message);
|
|
|
|
|
new Messenger().post(message);
|
|
|
|
|
addError(message.message);
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
})();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|