mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
properly detect connection issues and show appropriate message.
This commit is contained in:
@@ -124,6 +124,7 @@ module.exports = function(grunt) {
|
|||||||
grunt.loadNpmTasks('grunt-curl');
|
grunt.loadNpmTasks('grunt-curl');
|
||||||
// Default task(s).
|
// Default task(s).
|
||||||
grunt.registerTask('default', ['copy','less:bootstrap','handlebars', 'watch']);
|
grunt.registerTask('default', ['copy','less:bootstrap','handlebars', 'watch']);
|
||||||
|
grunt.registerTask('package', ['copy','less:bootstrap','handlebars']);
|
||||||
grunt.registerTask('update', ['curl']);
|
grunt.registerTask('update', ['curl']);
|
||||||
|
|
||||||
};
|
};
|
@@ -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;
|
||||||
|
Reference in New Issue
Block a user