From a5adc7eff10768fd685b0a01b65af8936716d202 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 24 Sep 2016 14:10:10 -0700 Subject: [PATCH] Don't cache results from a failed applist query --- static/js/utils.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/static/js/utils.js b/static/js/utils.js index d1477ed..2025a4a 100644 --- a/static/js/utils.js +++ b/static/js/utils.js @@ -263,6 +263,13 @@ NvHTTP.prototype = { getAppListWithCacheFlush: function () { return sendMessage('openUrl', [this._baseUrlHttps + '/applist?' + this._buildUidStr(), false]).then(function (ret) { $xml = this._parseXML(ret); + $root = $xml.find("root"); + + if ($root.attr("status_code") != 200) { + // TODO: Bubble up an error here + console.log('applist request failed: ' + $root.attr("status_code")); + return []; + } var rootElement = $xml.find("root")[0]; var appElements = rootElement.getElementsByTagName("App");