[7.x] [ES UI] Error handling (#68809) (#69146)

This commit is contained in:
Alison Goryachev 2020-06-15 12:00:12 -04:00 committed by GitHub
parent b10e6b14e9
commit 661fd85d34
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
73 changed files with 194 additions and 183 deletions

View file

@ -0,0 +1,20 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
export { isEsError } from './is_es_error';

View file

@ -0,0 +1,33 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import * as legacyElasticsearch from 'elasticsearch';
const esErrorsParent = legacyElasticsearch.errors._Abstract;
interface RequestError extends Error {
statusCode?: number;
}
export function isEsError(err: RequestError) {
const isInstanceOfEsError = err instanceof esErrorsParent;
const hasStatusCode = Boolean(err.statusCode);
return isInstanceOfEsError && hasStatusCode;
}

View file

@ -1,5 +1,6 @@
{
"id": "esUiShared",
"version": "kibana",
"ui": true
"ui": true,
"server": true
}

View file

@ -0,0 +1,20 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
export { isEsError } from '../../__packages_do_not_import__/errors';

View file

@ -0,0 +1,28 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
export { isEsError } from './errors';
/** dummy plugin*/
export function plugin() {
return new (class EsUiSharedPlugin {
setup() {}
start() {}
})();
}

View file

@ -1,13 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import * as legacyElasticsearch from 'elasticsearch';
const esErrorsParent = legacyElasticsearch.errors._Abstract;
export function isEsError(err: Error) {
return err instanceof esErrorsParent;
}

View file

@ -30,7 +30,7 @@ import { registerApiRoutes } from './routes';
import { License } from './services';
import { elasticsearchJsPlugin } from './client/elasticsearch_ccr';
import { CrossClusterReplicationConfig } from './config';
import { isEsError } from './lib/is_es_error';
import { isEsError } from './shared_imports';
import { formatEsError } from './lib/format_es_error';
interface CrossClusterReplicationContext {

View file

@ -7,7 +7,7 @@
import { httpServiceMock, httpServerMock } from 'src/core/server/mocks';
import { IRouter, kibanaResponseFactory, RequestHandler } from 'src/core/server';
import { isEsError } from '../../../lib/is_es_error';
import { isEsError } from '../../../shared_imports';
import { formatEsError } from '../../../lib/format_es_error';
import { License } from '../../../services';
import { mockRouteContext } from '../test_lib';

View file

@ -7,7 +7,7 @@
import { httpServiceMock, httpServerMock } from 'src/core/server/mocks';
import { IRouter, kibanaResponseFactory, RequestHandler } from 'src/core/server';
import { isEsError } from '../../../lib/is_es_error';
import { isEsError } from '../../../shared_imports';
import { formatEsError } from '../../../lib/format_es_error';
import { License } from '../../../services';
import { mockRouteContext } from '../test_lib';

View file

@ -7,7 +7,7 @@
import { httpServiceMock, httpServerMock } from 'src/core/server/mocks';
import { IRouter, kibanaResponseFactory, RequestHandler } from 'src/core/server';
import { isEsError } from '../../../lib/is_es_error';
import { isEsError } from '../../../shared_imports';
import { formatEsError } from '../../../lib/format_es_error';
import { License } from '../../../services';
import { mockRouteContext } from '../test_lib';

View file

@ -7,7 +7,7 @@
import { httpServiceMock, httpServerMock } from 'src/core/server/mocks';
import { IRouter, kibanaResponseFactory, RequestHandler } from 'src/core/server';
import { isEsError } from '../../../lib/is_es_error';
import { isEsError } from '../../../shared_imports';
import { formatEsError } from '../../../lib/format_es_error';
import { License } from '../../../services';
import { mockRouteContext } from '../test_lib';

View file

@ -7,7 +7,7 @@
import { httpServiceMock, httpServerMock } from 'src/core/server/mocks';
import { IRouter, kibanaResponseFactory, RequestHandler } from 'src/core/server';
import { isEsError } from '../../../lib/is_es_error';
import { isEsError } from '../../../shared_imports';
import { formatEsError } from '../../../lib/format_es_error';
import { License } from '../../../services';
import { mockRouteContext } from '../test_lib';

View file

@ -7,7 +7,7 @@
import { httpServiceMock, httpServerMock } from 'src/core/server/mocks';
import { IRouter, kibanaResponseFactory, RequestHandler } from 'src/core/server';
import { isEsError } from '../../../lib/is_es_error';
import { isEsError } from '../../../shared_imports';
import { formatEsError } from '../../../lib/format_es_error';
import { License } from '../../../services';
import { mockRouteContext } from '../test_lib';

View file

@ -7,7 +7,7 @@
import { httpServiceMock, httpServerMock } from 'src/core/server/mocks';
import { IRouter, kibanaResponseFactory, RequestHandler } from 'src/core/server';
import { isEsError } from '../../../lib/is_es_error';
import { isEsError } from '../../../shared_imports';
import { formatEsError } from '../../../lib/format_es_error';
import { License } from '../../../services';
import { mockRouteContext } from '../test_lib';

View file

@ -7,7 +7,7 @@
import { httpServiceMock, httpServerMock } from 'src/core/server/mocks';
import { IRouter, kibanaResponseFactory, RequestHandler } from 'src/core/server';
import { isEsError } from '../../../lib/is_es_error';
import { isEsError } from '../../../shared_imports';
import { formatEsError } from '../../../lib/format_es_error';
import { License } from '../../../services';
import { mockRouteContext } from '../test_lib';

View file

@ -7,7 +7,7 @@
import { httpServiceMock, httpServerMock } from 'src/core/server/mocks';
import { IRouter, kibanaResponseFactory, RequestHandler } from 'src/core/server';
import { isEsError } from '../../../lib/is_es_error';
import { isEsError } from '../../../shared_imports';
import { formatEsError } from '../../../lib/format_es_error';
import { License } from '../../../services';
import { mockRouteContext } from '../test_lib';

View file

@ -7,7 +7,7 @@
import { httpServiceMock, httpServerMock } from 'src/core/server/mocks';
import { IRouter, kibanaResponseFactory, RequestHandler } from 'src/core/server';
import { isEsError } from '../../../lib/is_es_error';
import { isEsError } from '../../../shared_imports';
import { formatEsError } from '../../../lib/format_es_error';
import { License } from '../../../services';
import { mockRouteContext } from '../test_lib';

View file

@ -7,7 +7,7 @@
import { httpServiceMock, httpServerMock } from 'src/core/server/mocks';
import { IRouter, kibanaResponseFactory, RequestHandler } from 'src/core/server';
import { isEsError } from '../../../lib/is_es_error';
import { isEsError } from '../../../shared_imports';
import { formatEsError } from '../../../lib/format_es_error';
import { License } from '../../../services';
import { mockRouteContext } from '../test_lib';

View file

@ -7,7 +7,7 @@
import { httpServiceMock, httpServerMock } from 'src/core/server/mocks';
import { IRouter, kibanaResponseFactory, RequestHandler } from 'src/core/server';
import { isEsError } from '../../../lib/is_es_error';
import { isEsError } from '../../../shared_imports';
import { formatEsError } from '../../../lib/format_es_error';
import { License } from '../../../services';
import { mockRouteContext } from '../test_lib';

View file

@ -7,7 +7,7 @@
import { httpServiceMock, httpServerMock } from 'src/core/server/mocks';
import { IRouter, kibanaResponseFactory, RequestHandler } from 'src/core/server';
import { isEsError } from '../../../lib/is_es_error';
import { isEsError } from '../../../shared_imports';
import { formatEsError } from '../../../lib/format_es_error';
import { License } from '../../../services';
import { mockRouteContext } from '../test_lib';

View file

@ -4,4 +4,4 @@
* you may not use this file except in compliance with the Elastic License.
*/
export { isEsError } from './is_es_error';
export { isEsError } from '../../../../src/plugins/es_ui_shared/server';

View file

@ -9,7 +9,7 @@ import { LicensingPluginSetup } from '../../licensing/server';
import { IndexManagementPluginSetup } from '../../index_management/server';
import { RemoteClustersPluginSetup } from '../../remote_clusters/server';
import { License } from './services';
import { isEsError } from './lib/is_es_error';
import { isEsError } from './shared_imports';
import { formatEsError } from './lib/format_es_error';
export interface Dependencies {

View file

@ -1,13 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import * as legacyElasticsearch from 'elasticsearch';
const esErrorsParent = legacyElasticsearch.errors._Abstract;
export function isEsError(err: Error): boolean {
return err instanceof esErrorsParent;
}

View file

@ -14,7 +14,7 @@ import { Dependencies } from './types';
import { registerApiRoutes } from './routes';
import { License } from './services';
import { IndexLifecycleManagementConfig } from './config';
import { isEsError } from './lib/is_es_error';
import { isEsError } from './shared_imports';
const indexLifecycleDataEnricher = async (indicesList: any, callAsCurrentUser: APICaller) => {
if (!indicesList || !indicesList.length) {

View file

@ -4,4 +4,4 @@
* you may not use this file except in compliance with the Elastic License.
*/
export { isEsError } from './is_es_error';
export { isEsError } from '../../../../src/plugins/es_ui_shared/server';

View file

@ -10,7 +10,7 @@ import { LicensingPluginSetup } from '../../licensing/server';
import { IndexManagementPluginSetup } from '../../index_management/server';
import { License } from './services';
import { IndexLifecycleManagementConfig } from './config';
import { isEsError } from './lib/is_es_error';
import { isEsError } from './shared_imports';
export interface Dependencies {
licensing: LicensingPluginSetup;

View file

@ -1,13 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import * as legacyElasticsearch from 'elasticsearch';
const esErrorsParent = legacyElasticsearch.errors._Abstract;
export function isEsError(err: Error) {
return err instanceof esErrorsParent;
}

View file

@ -24,7 +24,7 @@ import { PLUGIN } from '../common';
import { Dependencies } from './types';
import { ApiRoutes } from './routes';
import { License, IndexDataEnricher } from './services';
import { isEsError } from './lib/is_es_error';
import { isEsError } from './shared_imports';
import { elasticsearchJsPlugin } from './client/elasticsearch';
export interface DataManagementContext {

View file

@ -4,4 +4,4 @@
* you may not use this file except in compliance with the Elastic License.
*/
export { isEsError } from './is_es_error';
export { isEsError } from '../../../../src/plugins/es_ui_shared/server';

View file

@ -7,7 +7,7 @@ import { ScopedClusterClient, IRouter } from 'src/core/server';
import { LicensingPluginSetup } from '../../licensing/server';
import { SecurityPluginSetup } from '../../security/server';
import { License, IndexDataEnricher } from './services';
import { isEsError } from './lib/is_es_error';
import { isEsError } from './shared_imports';
export interface Dependencies {
security: SecurityPluginSetup;

View file

@ -1,13 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import * as legacyElasticsearch from 'elasticsearch';
const esErrorsParent = legacyElasticsearch.errors._Abstract;
export function isEsError(err: Error) {
return err instanceof esErrorsParent;
}

View file

@ -11,7 +11,7 @@ import { PLUGIN_ID, PLUGIN_MIN_LICENSE_TYPE } from '../common/constants';
import { License } from './services';
import { ApiRoutes } from './routes';
import { isEsError } from './lib';
import { isEsError } from './shared_imports';
import { Dependencies } from './types';
export class IngestPipelinesPlugin implements Plugin<void, void, any, any> {

View file

@ -4,4 +4,4 @@
* you may not use this file except in compliance with the Elastic License.
*/
export { isEsError } from './is_es_error';
export { isEsError } from '../../../../src/plugins/es_ui_shared/server';

View file

@ -8,7 +8,7 @@ import { IRouter } from 'src/core/server';
import { LicensingPluginSetup } from '../../licensing/server';
import { SecurityPluginSetup } from '../../security/server';
import { License } from './services';
import { isEsError } from './lib';
import { isEsError } from './shared_imports';
export interface Dependencies {
security: SecurityPluginSetup;

View file

@ -1,13 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import * as legacyElasticsearch from 'elasticsearch';
const esErrorsParent = legacyElasticsearch.errors._Abstract;
export function isEsError(err: Error) {
return err instanceof esErrorsParent;
}

View file

@ -7,7 +7,7 @@
import { Plugin, CoreSetup } from 'kibana/server';
import { ApiRoutes } from './routes';
import { isEsError } from './lib/is_es_error';
import { isEsError } from './shared_imports';
import { Dependencies } from './types';
export class LicenseManagementServerPlugin implements Plugin<void, void, any, any> {

View file

@ -0,0 +1,7 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
export { isEsError } from '../../../../src/plugins/es_ui_shared/server';

View file

@ -7,7 +7,7 @@ import { ScopedClusterClient, IRouter } from 'kibana/server';
import { LicensingPluginSetup } from '../../licensing/server';
import { SecurityPluginSetup } from '../../security/server';
import { isEsError } from './lib/is_es_error';
import { isEsError } from './shared_imports';
export interface Dependencies {
licensing: LicensingPluginSetup;

View file

@ -1,13 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import * as legacyElasticsearch from 'elasticsearch';
const esErrorsParent = legacyElasticsearch.errors._Abstract;
export function isEsError(err: Error) {
return err instanceof esErrorsParent;
}

View file

@ -7,7 +7,7 @@ import { schema } from '@kbn/config-schema';
import { API_BASE_PATH } from '../../../common/constants';
import { RouteDependencies } from '../../types';
import { isEsError } from '../../lib';
import { isEsError } from '../../shared_imports';
const bodySchema = schema.string();

View file

@ -0,0 +1,7 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
export { isEsError } from '../../../../src/plugins/es_ui_shared/server';

View file

@ -1,13 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import * as legacyElasticsearch from 'elasticsearch';
const esErrorsParent = legacyElasticsearch.errors._Abstract;
export function isEsError(err: Error) {
return err instanceof esErrorsParent;
}

View file

@ -13,7 +13,7 @@ import { serializeCluster, Cluster } from '../../../common/lib';
import { doesClusterExist } from '../../lib/does_cluster_exist';
import { API_BASE_PATH, PROXY_MODE, SNIFF_MODE } from '../../../common/constants';
import { licensePreRoutingFactory } from '../../lib/license_pre_routing_factory';
import { isEsError } from '../../lib/is_es_error';
import { isEsError } from '../../shared_imports';
import { RouteDependencies } from '../../types';
const bodyValidation = schema.object({

View file

@ -14,7 +14,7 @@ import { serializeCluster } from '../../../common/lib';
import { API_BASE_PATH } from '../../../common/constants';
import { doesClusterExist } from '../../lib/does_cluster_exist';
import { licensePreRoutingFactory } from '../../lib/license_pre_routing_factory';
import { isEsError } from '../../lib/is_es_error';
import { isEsError } from '../../shared_imports';
const paramsValidation = schema.object({
nameOrNames: schema.string(),

View file

@ -10,7 +10,7 @@ import { RequestHandler } from 'src/core/server';
import { deserializeCluster } from '../../../common/lib';
import { API_BASE_PATH } from '../../../common/constants';
import { licensePreRoutingFactory } from '../../lib/license_pre_routing_factory';
import { isEsError } from '../../lib/is_es_error';
import { isEsError } from '../../shared_imports';
import { RouteDependencies } from '../../types';
export const register = (deps: RouteDependencies): void => {

View file

@ -14,7 +14,7 @@ import { serializeCluster, deserializeCluster, Cluster, ClusterInfoEs } from '..
import { doesClusterExist } from '../../lib/does_cluster_exist';
import { RouteDependencies } from '../../types';
import { licensePreRoutingFactory } from '../../lib/license_pre_routing_factory';
import { isEsError } from '../../lib/is_es_error';
import { isEsError } from '../../shared_imports';
const bodyValidation = schema.object({
skipUnavailable: schema.boolean(),

View file

@ -0,0 +1,7 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
export { isEsError } from '../../../../src/plugins/es_ui_shared/server';

View file

@ -1,13 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import * as legacyElasticsearch from 'elasticsearch';
const esErrorsParent = legacyElasticsearch.errors._Abstract;
export function isEsError(err: Error) {
return err instanceof esErrorsParent;
}

View file

@ -35,7 +35,7 @@ import { rollupDataEnricher } from './rollup_data_enricher';
import { IndexPatternsFetcher } from './shared_imports';
import { registerRollupSearchStrategy } from './lib/search_strategies';
import { elasticsearchJsPlugin } from './client/elasticsearch_rollup';
import { isEsError } from './lib/is_es_error';
import { isEsError } from './shared_imports';
import { formatEsError } from './lib/format_es_error';
import { getCapabilitiesForRollupIndices } from './lib/map_capabilities';
import { mergeCapabilitiesWithFields } from './lib/merge_capabilities_with_fields';

View file

@ -5,3 +5,5 @@
*/
export { IndexPatternsFetcher } from '../../../../src/plugins/data/server';
export { isEsError } from '../../../../src/plugins/es_ui_shared/server';

View file

@ -12,7 +12,7 @@ import { IndexManagementPluginSetup } from '../../index_management/server';
import { LicensingPluginSetup } from '../../licensing/server';
import { License } from './services';
import { IndexPatternsFetcher } from './shared_imports';
import { isEsError } from './lib/is_es_error';
import { isEsError } from './shared_imports';
import { formatEsError } from './lib/format_es_error';
import { getCapabilitiesForRollupIndices } from './lib/map_capabilities';
import { mergeCapabilitiesWithFields } from './lib/merge_capabilities_with_fields';

View file

@ -12,5 +12,4 @@ export { cleanSettings } from './clean_settings';
export { getManagedRepositoryName } from './get_managed_repository_name';
export { getManagedPolicyNames } from './get_managed_policy_names';
export { deserializeRestoreShard } from './restore_serialization';
export { isEsError } from './is_es_error';
export { wrapEsError } from './wrap_es_error';

View file

@ -1,13 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import * as legacyElasticsearch from 'elasticsearch';
const esErrorsParent = legacyElasticsearch.errors._Abstract;
export function isEsError(err: Error) {
return err instanceof esErrorsParent;
}

View file

@ -23,7 +23,8 @@ import {
import { PLUGIN } from '../common';
import { License } from './services';
import { ApiRoutes } from './routes';
import { isEsError, wrapEsError } from './lib';
import { wrapEsError } from './lib';
import { isEsError } from './shared_imports';
import { elasticsearchJsPlugin } from './client/elasticsearch_sr';
import { Dependencies } from './types';
import { SnapshotRestoreConfig } from './config';

View file

@ -0,0 +1,7 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
export { isEsError } from '../../../../src/plugins/es_ui_shared/server';

View file

@ -4,7 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { License } from '../../services';
import { isEsError, wrapEsError } from '../../lib';
import { wrapEsError } from '../../lib';
import { isEsError } from '../../shared_imports';
const license = new License();
license.getStatus = jest.fn().mockReturnValue({ isValid: true });

View file

@ -8,7 +8,8 @@ import { LicensingPluginSetup } from '../../licensing/server';
import { SecurityPluginSetup } from '../../security/server';
import { CloudSetup } from '../../cloud/server';
import { License } from './services';
import { isEsError, wrapEsError } from './lib';
import { wrapEsError } from './lib';
import { isEsError } from './shared_imports';
export interface Dependencies {
licensing: LicensingPluginSetup;

View file

@ -1,13 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import * as legacyElasticsearch from 'elasticsearch';
const esErrorsParent = legacyElasticsearch.errors._Abstract;
export function isEsError(err: Error) {
return err instanceof esErrorsParent;
}

View file

@ -7,7 +7,7 @@
import { schema } from '@kbn/config-schema';
import { IScopedClusterClient } from 'kibana/server';
import { reduce, size } from 'lodash';
import { isEsError } from '../../../lib/is_es_error';
import { isEsError } from '../../../shared_imports';
import { RouteDependencies } from '../../../types';
import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory';

View file

@ -6,7 +6,7 @@
import { schema } from '@kbn/config-schema';
import { IScopedClusterClient } from 'kibana/server';
import { isEsError } from '../../lib/is_es_error';
import { isEsError } from '../../shared_imports';
// @ts-ignore
import { Fields } from '../../models/fields/index';
import { licensePreRoutingFactory } from '../../lib/license_pre_routing_factory';

View file

@ -7,7 +7,7 @@
import { schema } from '@kbn/config-schema';
import { get } from 'lodash';
import { IScopedClusterClient } from 'kibana/server';
import { isEsError } from '../../lib/is_es_error';
import { isEsError } from '../../shared_imports';
import { INDEX_NAMES } from '../../../common/constants';
import { RouteDependencies } from '../../types';
import { licensePreRoutingFactory } from '../../lib/license_pre_routing_factory';

View file

@ -5,7 +5,7 @@
*/
import { IScopedClusterClient } from 'kibana/server';
import { isEsError } from '../../../lib/is_es_error';
import { isEsError } from '../../../shared_imports';
// @ts-ignore
import { Settings } from '../../../models/settings/index';
import { RouteDependencies } from '../../../types';

View file

@ -7,7 +7,7 @@
import { schema } from '@kbn/config-schema';
import { get } from 'lodash';
import { IScopedClusterClient } from 'kibana/server';
import { isEsError } from '../../../../lib/is_es_error';
import { isEsError } from '../../../../shared_imports';
// @ts-ignore
import { WatchStatus } from '../../../../models/watch_status/index';
import { RouteDependencies } from '../../../../types';

View file

@ -7,7 +7,7 @@
import { schema } from '@kbn/config-schema';
import { IScopedClusterClient } from 'kibana/server';
import { get } from 'lodash';
import { isEsError } from '../../../lib/is_es_error';
import { isEsError } from '../../../shared_imports';
import { RouteDependencies } from '../../../types';
import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory';
// @ts-ignore

View file

@ -7,7 +7,7 @@
import { schema } from '@kbn/config-schema';
import { IScopedClusterClient } from 'kibana/server';
import { get } from 'lodash';
import { isEsError } from '../../../lib/is_es_error';
import { isEsError } from '../../../shared_imports';
import { RouteDependencies } from '../../../types';
import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory';
// @ts-ignore

View file

@ -6,7 +6,7 @@
import { schema } from '@kbn/config-schema';
import { IScopedClusterClient } from 'kibana/server';
import { isEsError } from '../../../lib/is_es_error';
import { isEsError } from '../../../shared_imports';
import { RouteDependencies } from '../../../types';
import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory';

View file

@ -7,7 +7,7 @@
import { schema } from '@kbn/config-schema';
import { IScopedClusterClient } from 'kibana/server';
import { get } from 'lodash';
import { isEsError } from '../../../lib/is_es_error';
import { isEsError } from '../../../shared_imports';
import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory';
import { RouteDependencies } from '../../../types';

View file

@ -9,7 +9,7 @@ import { IScopedClusterClient } from 'kibana/server';
import { get } from 'lodash';
import { fetchAllFromScroll } from '../../../lib/fetch_all_from_scroll';
import { INDEX_NAMES, ES_SCROLL_SETTINGS } from '../../../../common/constants';
import { isEsError } from '../../../lib/is_es_error';
import { isEsError } from '../../../shared_imports';
import { RouteDependencies } from '../../../types';
import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory';
// @ts-ignore

View file

@ -7,7 +7,7 @@
import { schema } from '@kbn/config-schema';
import { IScopedClusterClient } from 'kibana/server';
import { get } from 'lodash';
import { isEsError } from '../../../lib/is_es_error';
import { isEsError } from '../../../shared_imports';
import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory';
// @ts-ignore
import { Watch } from '../../../models/watch/index';

View file

@ -8,7 +8,7 @@ import { schema } from '@kbn/config-schema';
import { i18n } from '@kbn/i18n';
import { WATCH_TYPES } from '../../../../common/constants';
import { serializeJsonWatch, serializeThresholdWatch } from '../../../../common/lib/serialization';
import { isEsError } from '../../../lib/is_es_error';
import { isEsError } from '../../../shared_imports';
import { RouteDependencies } from '../../../types';
import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory';

View file

@ -6,7 +6,7 @@
import { schema } from '@kbn/config-schema';
import { IScopedClusterClient } from 'kibana/server';
import { isEsError } from '../../../lib/is_es_error';
import { isEsError } from '../../../shared_imports';
import { RouteDependencies } from '../../../types';
import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory';

View file

@ -8,7 +8,7 @@ import { IScopedClusterClient } from 'kibana/server';
import { get } from 'lodash';
import { fetchAllFromScroll } from '../../../lib/fetch_all_from_scroll';
import { INDEX_NAMES, ES_SCROLL_SETTINGS } from '../../../../common/constants';
import { isEsError } from '../../../lib/is_es_error';
import { isEsError } from '../../../shared_imports';
import { RouteDependencies } from '../../../types';
import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory';
// @ts-ignore

View file

@ -0,0 +1,7 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
export { isEsError } from '../../../../src/plugins/es_ui_shared/server';