|
|
|
@ -51,24 +51,32 @@ window.onerror = function (msg, url, line) {
|
|
|
|
|
model.set('level', 'error');
|
|
|
|
|
NzbDrone.Shared.NotificationCollectionView.Instance.collection.add(model);
|
|
|
|
|
} catch (error) {
|
|
|
|
|
alert('Couldn\'t report JS error. ' + error);
|
|
|
|
|
|
|
|
|
|
console.log("An error occurred while reporting error. " + error);
|
|
|
|
|
console.log(msg);
|
|
|
|
|
alert('Couldn\'t report JS error. ' + msg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var suppressErrorAlert = false;
|
|
|
|
|
return suppressErrorAlert;
|
|
|
|
|
return false; //don't suppress default alerts and logs.
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$(document).ajaxError(function (event, xmlHttpRequest, ajaxOptions) {
|
|
|
|
|
|
|
|
|
|
//don't report 200 error codes
|
|
|
|
|
if (xmlHttpRequest.status >= 200 && xmlHttpRequest.status <= 300) {
|
|
|
|
|
return;
|
|
|
|
|
return undefined;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//doesn't report aborted requests
|
|
|
|
|
if (xmlHttpRequest.statusText === 'abort') {
|
|
|
|
|
return undefined;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var model = new NzbDrone.Shared.NotificationModel();
|
|
|
|
|
model.set('title', ajaxOptions.type + " " + ajaxOptions.url + " : " + xmlHttpRequest.statusText);
|
|
|
|
|
model.set('message', xmlHttpRequest.responseText);
|
|
|
|
|
model.set('level', 'error');
|
|
|
|
|
NzbDrone.Shared.NotificationCollectionView.Instance.collection.push(model);
|
|
|
|
|
|
|
|
|
|
var suppressErrorAlert = false;
|
|
|
|
|
return suppressErrorAlert;
|
|
|
|
|
return false;
|
|
|
|
|
});
|