[#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:
16
src/view.js
16
src/view.js
@@ -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});
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user