Skip to content

Commit ff785d8

Browse files
author
Chris Wiechmann
committed
Update search.js
1 parent beba882 commit ff785d8

File tree

1 file changed

+8
-1
lines changed
  • api-builder-plugin-fn-elasticsearch/src/actions

1 file changed

+8
-1
lines changed

api-builder-plugin-fn-elasticsearch/src/actions/search.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,14 @@ async function search(params, options) {
7878
addQueryParam("version");
7979

8080
options.logger.debug(`Using elastic search body: ${JSON.stringify(searchBody)}`);
81-
var queryResult = await client.search( searchBody, { ignore: [404], maxRetries: 3 });
81+
82+
var queryResult;
83+
try {
84+
queryResult = await client.search( searchBody, { ignore: [404], maxRetries: 3 });
85+
} catch (ex) {
86+
if(ex instanceof Error) throw ex;
87+
throw new Error(JSON.stringify(ex));
88+
}
8289

8390
if(queryResult.status === 404 && queryResult.error.type == "index_not_found_exception") {
8491
return options.setOutput('missingIndex', queryResult);

0 commit comments

Comments
 (0)