[Search] Style

Removed use of the keyword 'catch' when dealing
with promises, and instead used the second
parameter of then.
This commit is contained in:
slhale
2015-08-03 10:46:34 -07:00
parent eb0bdba666
commit d0bad46627
2 changed files with 4 additions and 4 deletions

View File

@ -166,7 +166,7 @@ define(
}).then(function (rawResults) { }).then(function (rawResults) {
// ...then process the data // ...then process the data
return processResults(rawResults, timestamp); return processResults(rawResults, timestamp);
})['catch'](function (err) { }, function (err) {
// In case of error, return nothing. (To prevent // In case of error, return nothing. (To prevent
// infinite loading time.) // infinite loading time.)
return {hits: [], total: 0}; return {hits: [], total: 0};

View File

@ -47,7 +47,7 @@ define(
mockHttp = jasmine.createSpy("$http"); mockHttp = jasmine.createSpy("$http");
mockHttpPromise = jasmine.createSpyObj( mockHttpPromise = jasmine.createSpyObj(
"promise", "promise",
[ "then", "catch" ] [ "then" ]
); );
mockHttp.andReturn(mockHttpPromise); mockHttp.andReturn(mockHttpPromise);
// allow chaining of promise.then().catch(); // allow chaining of promise.then().catch();
@ -59,7 +59,7 @@ define(
); );
mockObjectPromise = jasmine.createSpyObj( mockObjectPromise = jasmine.createSpyObj(
"promise", "promise",
[ "then", "catch" ] [ "then" ]
); );
mockObjectService.getObjects.andReturn(mockObjectPromise); mockObjectService.getObjects.andReturn(mockObjectPromise);
@ -107,7 +107,7 @@ define(
}); });
it("returns something when there is an ElasticSearch error", function () { 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(); expect(mockProviderResults).toBeDefined();
}); });
}); });