|
|
@ -1,4 +1,5 @@
|
|
|
|
define(['app', 'Shared/NotificationModel'], function () {
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
define(['app', 'Shared/NotificationModel'], function () {
|
|
|
|
|
|
|
|
|
|
|
|
var collection = Backbone.Collection.extend({
|
|
|
|
var collection = Backbone.Collection.extend({
|
|
|
|
|
|
|
|
|
|
|
@ -31,7 +32,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
console.log("An error occurred while reporting error. " + error);
|
|
|
|
console.log("An error occurred while reporting error. " + error);
|
|
|
|
console.log(msg);
|
|
|
|
console.log(msg);
|
|
|
|
alert('Couldn\'t report JS error. ' + msg);
|
|
|
|
window.alert('Couldn\'t report JS error. ' + msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return false; //don't suppress default alerts and logs.
|
|
|
|
return false; //don't suppress default alerts and logs.
|
|
|
@ -39,6 +40,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
$(document).ajaxError(function (event, xmlHttpRequest, ajaxOptions) {
|
|
|
|
$(document).ajaxError(function (event, xmlHttpRequest, ajaxOptions) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var model = new NzbDrone.Shared.NotificationModel();
|
|
|
|
|
|
|
|
model.set('level', 'error');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (xmlHttpRequest.status === 0 && xmlHttpRequest.readyState === 0) {
|
|
|
|
|
|
|
|
model.set('title', "Connection Failed");
|
|
|
|
|
|
|
|
model.set('message', "NzbDrone Server Not Reachable. make sure NzbDrone is running.");
|
|
|
|
|
|
|
|
self.push(model);
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//don't report 200 error codes
|
|
|
|
//don't report 200 error codes
|
|
|
|
if (xmlHttpRequest.status >= 200 && xmlHttpRequest.status <= 300) {
|
|
|
|
if (xmlHttpRequest.status >= 200 && xmlHttpRequest.status <= 300) {
|
|
|
|
return undefined;
|
|
|
|
return undefined;
|
|
|
@ -49,10 +60,8 @@
|
|
|
|
return undefined;
|
|
|
|
return undefined;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var model = new NzbDrone.Shared.NotificationModel();
|
|
|
|
|
|
|
|
model.set('title', ajaxOptions.type + " " + ajaxOptions.url + " : " + xmlHttpRequest.statusText);
|
|
|
|
model.set('title', ajaxOptions.type + " " + ajaxOptions.url + " : " + xmlHttpRequest.statusText);
|
|
|
|
model.set('message', xmlHttpRequest.responseText);
|
|
|
|
model.set('message', xmlHttpRequest.responseText);
|
|
|
|
model.set('level', 'error');
|
|
|
|
|
|
|
|
self.push(model);
|
|
|
|
self.push(model);
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|