From: Costa Tsaousis (ktsaou) Date: Mon, 18 Apr 2016 23:19:35 +0000 (+0300) Subject: error handling for charts index download #269 X-Git-Tag: v1.1.0~5^2 X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1bc192a7ca2a525b1d44b1d009e430be2718abdd;p=netdata.git error handling for charts index download #269 --- diff --git a/web/dashboard.js b/web/dashboard.js index 5e1dd51c..b6c62ae3 100644 --- a/web/dashboard.js +++ b/web/dashboard.js @@ -459,7 +459,9 @@ 101: { message: "Cannot load jQuery", alert: true }, 402: { message: "Chart library not found", alert: false }, 403: { message: "Chart library not enabled/is failed", alert: false }, - 404: { message: "Chart not found", alert: false } + 404: { message: "Chart not found", alert: false }, + 405: { message: "Cannot download charts index from server", alert: true }, + 406: { message: "Invalid charts index downloaded from server", alert: true } }; NETDATA.errorLast = { code: 0, @@ -546,13 +548,16 @@ .done(function(data) { if(data !== null) { var h = NETDATA.chartRegistry.fixid(host); - //console.log('downloaded all charts from ' + host + ' (' + h + ')'); self.charts[h] = data.charts; } + else NETDATA.error(406, host + '/api/v1/charts'); + if(typeof callback === 'function') callback(data); }) .fail(function() { + NETDATA.error(405, host + '/api/v1/charts'); + if(typeof callback === 'function') callback(null); }); diff --git a/web/index.html b/web/index.html index ea955780..546196b8 100644 --- a/web/index.html +++ b/web/index.html @@ -330,7 +330,7 @@ - +