Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce search interceptor #60523

Merged
merged 138 commits into from
Mar 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
138 commits
Select commit Hold shift + click to select a range
02c57f3
Add async search strategy
lukasolson Dec 9, 2019
41b7c6a
Add async search
lukasolson Dec 9, 2019
cf5ceb9
Fix async strategy and add tests
lukasolson Dec 13, 2019
5ad5b36
Merge branch 'master' into asyncSearch
lukasolson Dec 13, 2019
2009343
Move types to separate file
lukasolson Dec 14, 2019
ebebdaf
Revert changes to demo search
lukasolson Dec 14, 2019
65c39b6
Merge branch 'master' into asyncSearch
lukasolson Dec 17, 2019
5dd876f
Update demo search strategy to use async
lukasolson Dec 18, 2019
d487812
Add async es search strategy
lukasolson Dec 18, 2019
7433aa6
Return response as rawResponse
lukasolson Dec 19, 2019
93ea93e
Poll after initial request
lukasolson Dec 19, 2019
8e8eb7b
Merge branch 'master' into asyncSearch
lukasolson Jan 15, 2020
f15c4af
Merge branch 'master' into enhancedEsSearch
lukasolson Jan 15, 2020
50b4b69
Merge branch 'master' into asyncSearch
lukasolson Jan 23, 2020
2bed4a6
Merge branch 'master' into asyncSearch
lukasolson Jan 23, 2020
b6d9c25
Merge branch 'asyncSearch' into enhancedEsSearch
lukasolson Jan 23, 2020
7260761
Add cancellation to search strategies
lukasolson Jan 24, 2020
be300db
Add tests
lukasolson Jan 27, 2020
fa02de6
Merge branch 'master' into asyncSearch
lukasolson Jan 27, 2020
4e524d1
Merge branch 'asyncSearch' into enhancedEsSearch
lukasolson Jan 27, 2020
7ad5755
Merge branch 'master' into asyncSearch
lukasolson Jan 28, 2020
e4eb651
Simplify async search strategy
lukasolson Jan 28, 2020
b6a7f5e
Merge branch 'asyncSearch' into enhancedEsSearch
lukasolson Jan 28, 2020
6188c74
Move loadingCount to search strategy
lukasolson Jan 29, 2020
765ec61
Merge branch 'loadingCount' into asyncSearch
lukasolson Jan 30, 2020
b35ca0f
Merge branch 'asyncSearch' into enhancedEsSearch
lukasolson Jan 30, 2020
f15f138
Update abort controller library
lukasolson Feb 3, 2020
4d36124
Bootstrap
lukasolson Feb 3, 2020
1943855
Merge branch 'master' into abortController
elasticmachine Feb 3, 2020
c7e328c
Merge branch 'master' into asyncSearch
elasticmachine Feb 4, 2020
491e8bb
Abort when the request is aborted
lukasolson Feb 4, 2020
d5d995c
Merge branch 'master' into abortController
lukasolson Feb 4, 2020
8afc936
Merge branch 'abortController' of github.com:lukasolson/kibana into a…
lukasolson Feb 4, 2020
48238d8
Merge branch 'abortController' into abortSearch
lukasolson Feb 4, 2020
0db7257
Add utility and update value suggestions route
lukasolson Feb 4, 2020
2f00b41
Merge branch 'master' into asyncSearch
lukasolson Feb 4, 2020
b8711ca
Merge branch 'abortController' into asyncSearch
lukasolson Feb 4, 2020
f02792f
Fix bad merge conflict
lukasolson Feb 4, 2020
30886d1
Merge branch 'abortController' into asyncSearch
lukasolson Feb 4, 2020
2cb8dd4
Update tests
lukasolson Feb 4, 2020
229af5a
Merge remote-tracking branch 'origin/asyncSearch' into asyncSearch
lukasolson Feb 4, 2020
2a53834
Move to data_enhanced plugin
lukasolson Feb 5, 2020
3a6dd41
Merge branch 'asyncSearch' into enhancedEsSearch
lukasolson Feb 5, 2020
f376da7
Merge branch 'master' into abortSearch
lukasolson Feb 5, 2020
ad5f188
Remove bad merge
lukasolson Feb 6, 2020
48b88c0
Revert switching abort controller libraries
lukasolson Feb 10, 2020
21dd1c8
Revert package.json in lib
lukasolson Feb 10, 2020
16064ff
Merge branch 'revertAbortController' into abortSearch
lukasolson Feb 10, 2020
a079c15
Merge branch 'master' into revertAbortController
elasticmachine Feb 10, 2020
0b87a0b
Move to previous abort controller
lukasolson Feb 10, 2020
55d76f3
Merge branch 'master' into abortSearch
lukasolson Feb 10, 2020
1aa401d
Merge branch 'master' into asyncSearch
lukasolson Feb 10, 2020
7cd1092
Merge branch 'asyncSearch' into enhancedEsSearch
lukasolson Feb 10, 2020
8292c1e
Merge branch 'master' into revertAbortController
lukasolson Feb 10, 2020
e45bdd6
Merge remote-tracking branch 'origin/revertAbortController' into reve…
lukasolson Feb 10, 2020
d3291a8
Merge branch 'master' into revertAbortController
elasticmachine Feb 12, 2020
599c564
Merge branch 'master' into enhancedEsSearch
elasticmachine Feb 12, 2020
c25d3a9
Merge branch 'master' into asyncSearch
elasticmachine Feb 12, 2020
f996a65
Merge branch 'master' into abortSearch
lukasolson Feb 12, 2020
91655f2
Merge branch 'abortSearch' into asyncSearch
lukasolson Feb 12, 2020
8447981
Merge branch 'asyncSearch' of github.com:lukasolson/kibana into async…
lukasolson Feb 12, 2020
4badc14
Merge branch 'master' into revertAbortController
lukasolson Feb 12, 2020
6df7a41
Merge branch 'asyncSearch' into enhancedEsSearch
lukasolson Feb 12, 2020
7dc053e
Merge branch 'enhancedEsSearch' of github.com:lukasolson/kibana into …
lukasolson Feb 12, 2020
e959aad
Add support for frozen indices
lukasolson Feb 14, 2020
c9352e3
Merge branch 'master' into revertAbortController
lukasolson Feb 14, 2020
100a728
Merge branch 'revertAbortController' into abortSearch
lukasolson Feb 14, 2020
35b1abb
Fix test to use fake timers to run debounced handlers
lukasolson Feb 14, 2020
84bda2e
Merge branch 'abortSearch' into asyncSearch
lukasolson Feb 14, 2020
8822ec8
Merge branch 'asyncSearch' into enhancedEsSearch
lukasolson Feb 14, 2020
0db590e
Merge branch 'master' into abortSearch
lukasolson Feb 18, 2020
b2ebe1e
Merge branch 'master' into asyncSearch
lukasolson Feb 18, 2020
5ec9c30
Merge branch 'master' into enhancedEsSearch
lukasolson Feb 18, 2020
6cff829
Merge branch 'master' into abortSearch
lukasolson Feb 18, 2020
831cb9f
Merge branch 'master' into asyncSearch
lukasolson Feb 18, 2020
d71d900
Revert changes to example plugin
lukasolson Feb 18, 2020
914d330
Fix loading bar not going away when cancelling
lukasolson Feb 18, 2020
fb5ef63
Merge branch 'master' into abortSearch
lukasolson Feb 18, 2020
df1fa5e
Merge branch 'abortSearch' into asyncSearch
lukasolson Feb 18, 2020
07b6903
Merge branch 'asyncSearch' into enhancedEsSearch
lukasolson Feb 18, 2020
c8c1a95
Merge branch 'master' into abortSearch
lukasolson Feb 19, 2020
6a6df45
Merge branch 'master' into asyncSearch
lukasolson Feb 19, 2020
d8fd759
Call getSearchStrategy instead of passing directly
lukasolson Feb 19, 2020
b7407ea
Merge branch 'master' into asyncSearch
lukasolson Feb 20, 2020
e6f11db
Add async demo search strategy
lukasolson Feb 20, 2020
9337dea
Fix error with setting state
lukasolson Feb 20, 2020
365ace1
Merge branch 'master' into abortSearch
elasticmachine Feb 20, 2020
f0c2c9c
Merge branch 'master' into abortSearch
elasticmachine Feb 24, 2020
a6921d7
Merge branch 'master' into asyncSearch
lukasolson Feb 24, 2020
4267bf2
Update how aborting works
lukasolson Feb 24, 2020
418e4a1
Fix type checks
lukasolson Feb 24, 2020
159f5f0
Add test for loading count
lukasolson Feb 24, 2020
5bbae56
Merge remote-tracking branch 'origin/abortSearch' into abortSearch
lukasolson Feb 24, 2020
71ca887
Merge branch 'master' into asyncSearch
lukasolson Feb 24, 2020
dae93b1
Attempt to fix broken example test
lukasolson Feb 25, 2020
7f55c43
Merge branch 'master' into abortSearch
lukasolson Feb 25, 2020
248e094
Merge branch 'master' into asyncSearch
lukasolson Feb 25, 2020
1da1ce0
Revert changes to test
lukasolson Feb 25, 2020
ae16a51
Merge branch 'master' into asyncSearch
elasticmachine Feb 25, 2020
efa6cf6
Fix test
lukasolson Feb 25, 2020
cdb5417
Update name to camelCase
lukasolson Feb 25, 2020
b38d45d
Merge branch 'asyncSearch' of github.com:lukasolson/kibana into async…
lukasolson Feb 25, 2020
2ec0d0b
Fix failing test
lukasolson Feb 25, 2020
168ccc7
Merge branch 'abortSearch' into asyncSearch
lukasolson Feb 25, 2020
4325fec
Don't require data_enhanced in example plugin
lukasolson Feb 25, 2020
df2c99d
Merge branch 'asyncSearch' into enhancedEsSearch
lukasolson Feb 25, 2020
1f99f21
Actually send DELETE request
lukasolson Feb 26, 2020
74b3718
Use waitForCompletion parameter
lukasolson Feb 27, 2020
e30e047
Use default search params
lukasolson Feb 29, 2020
e45021c
Add support for rollups
lukasolson Mar 2, 2020
b71c661
Merge branch 'master' into enhancedEsSearch
lukasolson Mar 3, 2020
20ce66a
Only make changes needed for frozen indices/rollups
lukasolson Mar 3, 2020
3341881
Only make changes needed for frozen indices/rollups
lukasolson Mar 3, 2020
ce642c7
Add back in async functionality
lukasolson Mar 3, 2020
eaffdb5
Merge branch 'master' into enhancedEs
lukasolson Mar 3, 2020
7b5687b
Merge branch 'master' into enhancedEsSearch
lukasolson Mar 3, 2020
e0ce774
Fix tests/types
lukasolson Mar 5, 2020
7f6ed11
Merge branch 'master' into enhancedEs
lukasolson Mar 5, 2020
7070388
Merge branch 'enhancedEs' into enhancedEsSearch
lukasolson Mar 5, 2020
7d94b6d
Fix issue with sending empty body in GET
lukasolson Mar 5, 2020
9842cff
Don't include skipped in loaded/total
lukasolson Mar 5, 2020
d6bbb77
Merge branch 'enhancedEs' into enhancedEsSearch
lukasolson Mar 5, 2020
8805775
Don't wait before polling the next time
lukasolson Mar 5, 2020
171c7ff
Add search interceptor for bulk managing searches
lukasolson Mar 9, 2020
ebf1239
Simplify search logic
lukasolson Mar 9, 2020
5023a5e
Merge branch 'master' into enhancedEsSearch
lukasolson Mar 10, 2020
bc96081
Merge branch 'master' into enhancedEsSearch
lukasolson Mar 11, 2020
7331a1f
Merge branch 'enhancedEsSearch' into searchInterceptor
lukasolson Mar 11, 2020
3976cdb
Fix merge error
lukasolson Mar 11, 2020
df058c2
Review feedback
lukasolson Mar 12, 2020
d191ee4
Merge branch 'enhancedEsSearch' into searchInterceptor
lukasolson Mar 12, 2020
e095cd5
Add service for running beyond timeout
lukasolson Mar 12, 2020
f4dbd29
Refactor abort utils
lukasolson Mar 12, 2020
e61cbe5
Remove unneeded changes
lukasolson Mar 12, 2020
1b54481
Add tests
lukasolson Mar 13, 2020
1a57c2c
cleanup mocks
Mar 18, 2020
fd58f63
missing files
Mar 18, 2020
c7bec1e
Update src/legacy/core_plugins/kibana/public/dashboard/np_ready/dashb…
lizozom Mar 18, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
| [esQuery](./kibana-plugin-plugins-data-server.esquery.md) | |
| [fieldFormats](./kibana-plugin-plugins-data-server.fieldformats.md) | |
| [indexPatterns](./kibana-plugin-plugins-data-server.indexpatterns.md) | |
| [search](./kibana-plugin-plugins-data-server.search.md) | |

## Type Aliases

Expand All @@ -70,6 +69,5 @@
| [IFieldFormatsRegistry](./kibana-plugin-plugins-data-server.ifieldformatsregistry.md) | |
| [ISearch](./kibana-plugin-plugins-data-server.isearch.md) | |
| [ISearchCancel](./kibana-plugin-plugins-data-server.isearchcancel.md) | |
| [ParsedInterval](./kibana-plugin-plugins-data-server.parsedinterval.md) | |
| [TSearchStrategyProvider](./kibana-plugin-plugins-data-server.tsearchstrategyprovider.md) | Search strategy provider creates an instance of a search strategy with the request handler context bound to it. This way every search strategy can use whatever information they require from the request context. |

1 change: 1 addition & 0 deletions src/plugins/data/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ export * from './query';
export * from './search';
export * from './search/aggs';
export * from './types';
export * from './utils';
114 changes: 114 additions & 0 deletions src/plugins/data/common/utils/abort_utils.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
/*
* 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 { AbortError, toPromise, getCombinedSignal } from './abort_utils';

jest.useFakeTimers();

const flushPromises = () => new Promise(resolve => setImmediate(resolve));

describe('AbortUtils', () => {
describe('AbortError', () => {
test('should preserve `message`', () => {
const message = 'my error message';
const error = new AbortError(message);
expect(error.message).toBe(message);
});

test('should have a name of "AbortError"', () => {
const error = new AbortError();
expect(error.name).toBe('AbortError');
});
});

describe('toPromise', () => {
describe('resolves', () => {
test('should not resolve if the signal does not abort', async () => {
const controller = new AbortController();
const promise = toPromise(controller.signal);
const whenResolved = jest.fn();
promise.then(whenResolved);
await flushPromises();
expect(whenResolved).not.toBeCalled();
});

test('should resolve if the signal does abort', async () => {
const controller = new AbortController();
const promise = toPromise(controller.signal);
const whenResolved = jest.fn();
promise.then(whenResolved);
controller.abort();
await flushPromises();
expect(whenResolved).toBeCalled();
});
});

describe('rejects', () => {
test('should not reject if the signal does not abort', async () => {
const controller = new AbortController();
const promise = toPromise(controller.signal, true);
const whenRejected = jest.fn();
promise.catch(whenRejected);
await flushPromises();
expect(whenRejected).not.toBeCalled();
});

test('should reject if the signal does abort', async () => {
const controller = new AbortController();
const promise = toPromise(controller.signal, true);
const whenRejected = jest.fn();
promise.catch(whenRejected);
controller.abort();
await flushPromises();
expect(whenRejected).toBeCalled();
});
});
});

describe('getCombinedSignal', () => {
test('should return an AbortSignal', () => {
const signal = getCombinedSignal([]);
expect(signal instanceof AbortSignal).toBe(true);
});

test('should not abort if none of the signals abort', async () => {
const controller1 = new AbortController();
const controller2 = new AbortController();
setTimeout(() => controller1.abort(), 2000);
setTimeout(() => controller2.abort(), 1000);
const signal = getCombinedSignal([controller1.signal, controller2.signal]);
expect(signal.aborted).toBe(false);
jest.advanceTimersByTime(500);
await flushPromises();
expect(signal.aborted).toBe(false);
});

test('should abort when the first signal aborts', async () => {
const controller1 = new AbortController();
const controller2 = new AbortController();
setTimeout(() => controller1.abort(), 2000);
setTimeout(() => controller2.abort(), 1000);
const signal = getCombinedSignal([controller1.signal, controller2.signal]);
expect(signal.aborted).toBe(false);
jest.advanceTimersByTime(1000);
await flushPromises();
expect(signal.aborted).toBe(true);
});
});
});
56 changes: 56 additions & 0 deletions src/plugins/data/common/utils/abort_utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* 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.
*/

/**
* Class used to signify that something was aborted. Useful for applications to conditionally handle
* this type of error differently than other errors.
*/
export class AbortError extends Error {
constructor(message = 'Aborted') {
super(message);
this.message = message;
this.name = 'AbortError';
}
}

/**
* Returns a `Promise` corresponding with when the given `AbortSignal` is aborted. Useful for
* situations when you might need to `Promise.race` multiple `AbortSignal`s, or an `AbortSignal`
* with any other expected errors (or completions).
* @param signal The `AbortSignal` to generate the `Promise` from
* @param shouldReject If `false`, the promise will be resolved, otherwise it will be rejected
*/
export function toPromise(signal: AbortSignal, shouldReject = false) {
return new Promise((resolve, reject) => {
const action = shouldReject ? reject : resolve;
if (signal.aborted) action();
signal.addEventListener('abort', action);
});
}

/**
* Returns an `AbortSignal` that will be aborted when the first of the given signals aborts.
* @param signals
*/
export function getCombinedSignal(signals: AbortSignal[]) {
const promises = signals.map(signal => toPromise(signal));
const controller = new AbortController();
Promise.race(promises).then(() => controller.abort());
return controller.signal;
}
1 change: 1 addition & 0 deletions src/plugins/data/common/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@

/** @internal */
export { shortenDottedString } from './shorten_dotted_string';
export { AbortError, toPromise, getCombinedSignal } from './abort_utils';
42 changes: 4 additions & 38 deletions src/plugins/data/public/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@

import { Plugin, DataPublicPluginSetup, DataPublicPluginStart, IndexPatternsContract } from '.';
import { fieldFormatsMock } from '../common/field_formats/mocks';
import { searchSetupMock } from './search/mocks';
import { AggTypeFieldFilters } from './search/aggs';
import { searchAggsStartMock } from './search/aggs/mocks';
import { searchSetupMock, searchStartMock } from './search/mocks';
import { queryServiceMock } from './query/mocks';

export type Setup = jest.Mocked<ReturnType<Plugin['setup']>>;
Expand All @@ -35,59 +33,28 @@ const autocompleteMock: any = {

const createSetupContract = (): Setup => {
const querySetupMock = queryServiceMock.createSetupContract();
const setupContract = {
return {
autocomplete: autocompleteMock,
search: searchSetupMock,
fieldFormats: fieldFormatsMock as DataPublicPluginSetup['fieldFormats'],
query: querySetupMock,
__LEGACY: {
esClient: {
search: jest.fn(),
msearch: jest.fn(),
},
},
};

return setupContract;
};

const createStartContract = (): Start => {
const queryStartMock = queryServiceMock.createStartContract();
const startContract = {
return {
actions: {
createFiltersFromEvent: jest.fn().mockResolvedValue(['yes']),
},
autocomplete: autocompleteMock,
getSuggestions: jest.fn(),
search: {
aggs: searchAggsStartMock(),
search: jest.fn(),
__LEGACY: {
AggConfig: jest.fn() as any,
AggType: jest.fn(),
aggTypeFieldFilters: new AggTypeFieldFilters(),
FieldParamType: jest.fn(),
MetricAggType: jest.fn(),
parentPipelineAggHelper: jest.fn() as any,
siblingPipelineAggHelper: jest.fn() as any,
esClient: {
search: jest.fn(),
msearch: jest.fn(),
},
},
},
search: searchStartMock,
fieldFormats: fieldFormatsMock as DataPublicPluginStart['fieldFormats'],
query: queryStartMock,
ui: {
IndexPatternSelect: jest.fn(),
SearchBar: jest.fn(),
},
__LEGACY: {
esClient: {
search: jest.fn(),
msearch: jest.fn(),
},
},
indexPatterns: ({
make: () => ({
fieldsFetcher: {
Expand All @@ -97,7 +64,6 @@ const createStartContract = (): Start => {
get: jest.fn().mockReturnValue(Promise.resolve({})),
} as unknown) as IndexPatternsContract,
};
return startContract;
};

export { searchSourceMock } from './search/mocks';
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/data/public/search/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,6 @@ export {
SortDirection,
} from './search_source';

export { SearchInterceptor } from './search_interceptor';

export { FetchOptions } from './fetch';
25 changes: 24 additions & 1 deletion src/plugins/data/public/search/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
* under the License.
*/

import { searchAggsSetupMock } from './aggs/mocks';
import { searchAggsSetupMock, searchAggsStartMock } from './aggs/mocks';
import { AggTypeFieldFilters } from './aggs/param_types/filter';
import { ISearchStart } from './types';

export * from './search_source/mocks';

Expand All @@ -26,3 +28,24 @@ export const searchSetupMock = {
registerSearchStrategyContext: jest.fn(),
registerSearchStrategyProvider: jest.fn(),
};

export const searchStartMock: jest.Mocked<ISearchStart> = {
aggs: searchAggsStartMock(),
search: jest.fn(),
cancel: jest.fn(),
getPendingCount$: jest.fn(),
runBeyondTimeout: jest.fn(),
__LEGACY: {
AggConfig: jest.fn() as any,
AggType: jest.fn(),
aggTypeFieldFilters: new AggTypeFieldFilters(),
FieldParamType: jest.fn(),
MetricAggType: jest.fn(),
parentPipelineAggHelper: jest.fn() as any,
siblingPipelineAggHelper: jest.fn() as any,
esClient: {
search: jest.fn(),
msearch: jest.fn(),
},
},
};
30 changes: 30 additions & 0 deletions src/plugins/data/public/search/request_timeout_error.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* 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.
*/

/**
* Class used to signify that a request timed out. Useful for applications to conditionally handle
* this type of error differently than other errors.
*/
export class RequestTimeoutError extends Error {
constructor(message = 'Request timed out') {
super(message);
this.message = message;
this.name = 'RequestTimeoutError';
}
}
Loading