From d0bad46627b1c646f0e4080dc706cf9d8e6039b0 Mon Sep 17 00:00:00 2001 From: slhale Date: Mon, 3 Aug 2015 10:46:34 -0700 Subject: [PATCH] [Search] Style Removed use of the keyword 'catch' when dealing with promises, and instead used the second parameter of then. --- .../search/src/providers/ElasticsearchSearchProvider.js | 2 +- .../test/providers/ElasticsearchSearchProviderSpec.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/search/src/providers/ElasticsearchSearchProvider.js b/platform/search/src/providers/ElasticsearchSearchProvider.js index 24522a7eac..3f0398b5a0 100644 --- a/platform/search/src/providers/ElasticsearchSearchProvider.js +++ b/platform/search/src/providers/ElasticsearchSearchProvider.js @@ -166,7 +166,7 @@ define( }).then(function (rawResults) { // ...then process the data return processResults(rawResults, timestamp); - })['catch'](function (err) { + }, function (err) { // In case of error, return nothing. (To prevent // infinite loading time.) return {hits: [], total: 0}; diff --git a/platform/search/test/providers/ElasticsearchSearchProviderSpec.js b/platform/search/test/providers/ElasticsearchSearchProviderSpec.js index e127f63f11..8ba25ed2be 100644 --- a/platform/search/test/providers/ElasticsearchSearchProviderSpec.js +++ b/platform/search/test/providers/ElasticsearchSearchProviderSpec.js @@ -47,7 +47,7 @@ define( mockHttp = jasmine.createSpy("$http"); mockHttpPromise = jasmine.createSpyObj( "promise", - [ "then", "catch" ] + [ "then" ] ); mockHttp.andReturn(mockHttpPromise); // allow chaining of promise.then().catch(); @@ -59,7 +59,7 @@ define( ); mockObjectPromise = jasmine.createSpyObj( "promise", - [ "then", "catch" ] + [ "then" ] ); mockObjectService.getObjects.andReturn(mockObjectPromise); @@ -107,7 +107,7 @@ define( }); it("returns something when there is an ElasticSearch error", function () { - mockProviderResults = mockHttpPromise['catch'].mostRecentCall.args[0](); + mockProviderResults = mockHttpPromise.then.mostRecentCall.args[1](); expect(mockProviderResults).toBeDefined(); }); });