Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kertal committed Feb 22, 2023
1 parent 0fc1962 commit 4068038
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 0 additions & 3 deletions src/plugins/data_views/common/data_views/data_views.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,6 @@ describe('IndexPatterns', () => {

test('allowNoIndex flag preserves existing fields when index is missing', async () => {
const id = '2';
apiClient.getFieldsForWildcard = jest.fn().mockImplementation(async () => {
throw new DataViewMissingIndices('Catch me if you can!');
});
setDocsourcePayload(id, {
id: 'foo',
version: 'foo',
Expand Down
8 changes: 6 additions & 2 deletions src/plugins/data_views/common/data_views/data_views.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ export interface DataViewsServiceDeps {
*/
onNotification: OnNotification;
/**
* Handler when there are missing indices
* Handler triggered when there are no indices
* @param error Error object
*/
onMissingIndices?: (error: Error) => void;
/**
Expand Down Expand Up @@ -338,10 +339,10 @@ export class DataViewsService {
apiClient,
fieldFormats,
onNotification,
onMissingIndices,
onError,
getCanSave = () => Promise.resolve(false),
getCanSaveAdvancedSettings,
onMissingIndices,
} = deps;
this.apiClient = apiClient;
this.config = uiSettings;
Expand Down Expand Up @@ -646,6 +647,9 @@ export class DataViewsService {
this.onMissingIndices?.(err);
return {};
}
if (!displayErrors) {
throw err;
}

this.onError(
err,
Expand Down

0 comments on commit 4068038

Please sign in to comment.