[filterBar] don't swallow errors

This commit is contained in:
Spencer Alger 2015-03-30 14:47:51 -07:00
parent 9f8a5a92bc
commit 9cb83548ae

View file

@ -1,7 +1,8 @@
define(function (require) {
return function watchFiltersProvider(Promise) {
return function watchFiltersProvider(Promise, Notifier) {
var _ = require('lodash');
var onlyDisabled = require('components/filter_bar/lib/onlyDisabled');
var notify = new Notifier({ location: 'Fitler Bar' });
return function ($scope, handlers) {
if (!handlers || !handlers.update || !handlers.fetch) {
@ -14,10 +15,10 @@ define(function (require) {
return Promise.resolve()
.then(handlers.update)
.then(function () {
if (!onlyDisabled(newFilters, oldFilters)) {
return handlers.fetch();
}
});
if (onlyDisabled(newFilters, oldFilters)) return;
return handlers.fetch();
})
.catch(notify.fatal);
});
};