[#35,all][m]: crude error catching for backends based on timeouts (best we can do with JSONP) - fixes #35.

* Show errors in UI
* required some extensive refactoring to use done/fail on promise rather than then
This commit is contained in:
Rufus Pollock
2012-02-10 03:14:52 +00:00
parent d17fa4a169
commit 21173b6acf
4 changed files with 78 additions and 24 deletions

View File

@@ -142,10 +142,14 @@ my.DataExplorer = Backbone.View.extend({
// retrieve basic data like headers etc
// note this.model and dataset returned are the same
this.model.fetch().then(function(dataset) {
self.el.find('.doc-count').text(self.model.docCount || 'Unknown');
self.query();
});
this.model.fetch()
.done(function(dataset) {
self.el.find('.doc-count').text(self.model.docCount || 'Unknown');
self.query();
})
.fail(function(error) {
my.notify(error.message, {category: 'error', persist: true});
});
},
query: function() {
@@ -158,6 +162,10 @@ my.DataExplorer = Backbone.View.extend({
.done(function() {
my.clearNotifications();
my.notify('Data loaded', {category: 'success'});
})
.fail(function(error) {
my.clearNotifications();
my.notify(error.message, {category: 'error', persist: true});
});
},