Skip to content

Commit

Permalink
add catch handlers and use PromiseEmitter pattern in visualize and di…
Browse files Browse the repository at this point in the history
…scover. Closes #188
  • Loading branch information
Spencer Alger committed Jul 22, 2014
1 parent b6647d9 commit b25291f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/kibana/apps/discover/controllers/discover.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,10 @@ define(function (require) {
timefilter.enabled(!!timefield);
});

$scope.searchSource.onError().then(function searchError(err) {
$scope.searchSource.onError(function (err) {
console.log(err);
notify.error('An error occured with your request. Reset your inputs and try again.');

return $scope.searchSource.onError().then(searchError);
});
}).catch(notify.fatal);

// Bind a result handler. Any time searchSource.fetch() is executed this gets called
// with the results
Expand Down
2 changes: 1 addition & 1 deletion src/kibana/apps/visualize/directives/visualize.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ define(function (require) {
render();
}).catch(notify.fatal);

vis.searchSource.onError(notify.error);
vis.searchSource.onError(notify.error).catch(notify.fatal);

$scope.$root.$broadcast('ready:vis');
});
Expand Down

0 comments on commit b25291f

Please sign in to comment.