From 268d165494f12f033c8804f42d0229d22fe3cdbf Mon Sep 17 00:00:00 2001 From: Yulia Cech Date: Thu, 15 Oct 2020 14:52:59 +0200 Subject: [PATCH] [ILM] Add comments about legacy and new es js client --- .../__packages_do_not_import__/errors/handle_es_error.ts | 4 ++++ .../__packages_do_not_import__/errors/is_es_error.ts | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/plugins/es_ui_shared/__packages_do_not_import__/errors/handle_es_error.ts b/src/plugins/es_ui_shared/__packages_do_not_import__/errors/handle_es_error.ts index 97c2f81972672..2dbcc0bac63ce 100644 --- a/src/plugins/es_ui_shared/__packages_do_not_import__/errors/handle_es_error.ts +++ b/src/plugins/es_ui_shared/__packages_do_not_import__/errors/handle_es_error.ts @@ -24,6 +24,10 @@ interface EsErrorHandlerParams { error: ApiError; response: KibanaResponseFactory; } + +/* + * For errors returned by the new elasticsearch js client. + */ export const handleEsError = ({ error, response }: EsErrorHandlerParams): IKibanaResponse => { // error.name is slightly better in terms of performance, since all errors now have name property if (error.name === 'ResponseError') { diff --git a/src/plugins/es_ui_shared/__packages_do_not_import__/errors/is_es_error.ts b/src/plugins/es_ui_shared/__packages_do_not_import__/errors/is_es_error.ts index 1e212307ca1cc..80a53aac328a4 100644 --- a/src/plugins/es_ui_shared/__packages_do_not_import__/errors/is_es_error.ts +++ b/src/plugins/es_ui_shared/__packages_do_not_import__/errors/is_es_error.ts @@ -25,6 +25,10 @@ interface RequestError extends Error { statusCode?: number; } +/* + * @deprecated + * Only works with legacy elasticsearch js client errors and will be removed after 7.x last + */ export function isEsError(err: RequestError) { const isInstanceOfEsError = err instanceof esErrorsParent; const hasStatusCode = Boolean(err.statusCode);