Browse Source

match error handling to controller/search

pull/782/head
Stephen Hess 8 years ago
parent
commit
ac0776e2be
  1. 6
      controller/place.js
  2. 6
      test/unit/controller/place.js

6
controller/place.js

@ -55,7 +55,11 @@ function setup( apiConfig, esclient ){
// error handler
if( err ){
req.errors.push( err );
if (_.isObject(err) && err.message) {
req.errors.push( err.message );
} else {
req.errors.push( err );
}
}
// set response data
else {

6
test/unit/controller/place.js

@ -137,7 +137,7 @@ module.exports.tests.error_conditions = (test, common) => {
const res = {};
const next = () => {
t.deepEqual(req.errors, [nonTimeoutError]);
t.deepEqual(req.errors, [nonTimeoutError.message]);
t.deepEqual(req.warnings, []);
t.deepEquals(res.data, undefined);
t.end();
@ -209,7 +209,7 @@ module.exports.tests.timeout = function(test, common) {
t.ok(infoMesssages.indexOf('request timed out on attempt 2, retrying') !== -1);
t.ok(infoMesssages.indexOf('request timed out on attempt 3, retrying') !== -1);
t.deepEqual(req.errors, [timeoutError]);
t.deepEqual(req.errors, [timeoutError.message]);
t.deepEqual(res, {});
t.end();
};
@ -306,7 +306,7 @@ module.exports.tests.timeout = function(test, common) {
const next = () => {
t.equal(searchServiceCallCount, 1);
t.deepEqual(req.errors, [nonTimeoutError]);
t.deepEqual(req.errors, [nonTimeoutError.message]);
t.end();
};

Loading…
Cancel
Save