Pass the original ES error message back with the correct status code

This commit is contained in:
Matthew Bargar 2015-11-18 18:31:13 -05:00
parent f3ee0ce361
commit 0f92cc7590

View file

@ -16,13 +16,13 @@ export default function (server) {
error instanceof esErrors.ServiceUnavailable ||
error instanceof esErrors.NoConnections ||
error instanceof esErrors.RequestTimeout) {
return Boom.serverTimeout();
} else if (error instanceof esErrors.Conflict) {
return Boom.conflict();
return Boom.serverTimeout(error);
} else if (error instanceof esErrors.Conflict || _.contains(error.message, 'index_template_already_exists')) {
return Boom.conflict(error);
} else if (error instanceof esErrors[403]) {
return Boom.forbidden();
return Boom.forbidden(error);
} else if (error instanceof esErrors.NotFound) {
return Boom.notFound();
return Boom.notFound(error);
} else if (error instanceof esErrors.BadRequest || error instanceof TypeError) {
return Boom.badRequest(error);
} else {