Skip to content

Commit

Permalink
oss strategy error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Liza K committed Mar 10, 2020
1 parent d5f9f8a commit 241c247
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ function discoverController(
title: i18n.translate('kbn.discover.errorLoadingData', {
defaultMessage: 'Error loading data',
}),
toastMessage: error.shortMessage,
toastMessage: error.shortMessage || error.body?.message,
});
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const esSearchStrategyProvider: TSearchStrategyProvider<typeof ES_SEARCH_

// Only default index pattern type is supported here.
// See data_enhanced for other type support.
if (!type) {
if (!!type) {
throw new Error(`Unsupported index pattern type ${type}`);
}

Expand Down
4 changes: 2 additions & 2 deletions src/plugins/data/server/search/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ export function registerSearchRoute(router: IRouter): void {
return res.ok({ body: response });
} catch (err) {
return res.customError({
statusCode: err.statusCode,
statusCode: err.statusCode || 500,
body: {
message: err.message,
attributes: {
error: err.body.error,
error: err.body?.error || err.message,
},
},
});
Expand Down

0 comments on commit 241c247

Please sign in to comment.