reorder the promise handlers so that the catch happens last

This commit is contained in:
Spencer Alger 2014-06-17 08:44:47 -07:00
parent d5a3aa982c
commit 8e56864356

View file

@ -36,19 +36,17 @@ define(function (require) {
resolve: {
savedSearch: function (savedSearches, $route, $location, Notifier, courier, indexPatterns) {
return savedSearches.get($route.current.params.id)
.catch(courier.redirectWhenMissing({
'index-pattern': '/settings/indices',
'*': '/discover'
}))
.then(function (savedSearch) {
if (!savedSearch) return;
return indexPatterns.getIds()
.then(indexPatterns.ensureSome())
.then(function () {
return savedSearch;
});
});
})
.catch(courier.redirectWhenMissing({
'index-pattern': '/settings/indices',
'*': '/discover'
}));
}
}
});