diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/handle_api_errors.test.ts b/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/handle_api_errors.test.ts index 45fc6749e3426f..6f2aec757eb376 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/handle_api_errors.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/handle_api_errors.test.ts @@ -14,9 +14,9 @@ jest.mock('./', () => ({ })); import { FlashMessagesLogic } from './'; -import { handleAPIError } from './handle_api_errors'; +import { flashAPIErrors } from './handle_api_errors'; -describe('handleAPIError', () => { +describe('flashAPIErrors', () => { const mockHttpError = { body: { statusCode: 404, @@ -33,7 +33,7 @@ describe('handleAPIError', () => { }); it('converts API errors into flash messages', () => { - handleAPIError(mockHttpError); + flashAPIErrors(mockHttpError); expect(FlashMessagesLogic.actions.setFlashMessages).toHaveBeenCalledWith([ { type: 'error', message: 'Could not find X' }, @@ -43,7 +43,7 @@ describe('handleAPIError', () => { }); it('queues messages when isQueued is passed', () => { - handleAPIError(mockHttpError, { isQueued: true }); + flashAPIErrors(mockHttpError, { isQueued: true }); expect(FlashMessagesLogic.actions.setQueuedMessages).toHaveBeenCalledWith([ { type: 'error', message: 'Could not find X' }, @@ -54,7 +54,7 @@ describe('handleAPIError', () => { it('displays a generic error message and re-throws non-API errors', () => { try { - handleAPIError(Error('whatever') as any); + flashAPIErrors(Error('whatever') as any); } catch (e) { expect(e.message).toEqual('whatever'); expect(FlashMessagesLogic.actions.setFlashMessages).toHaveBeenCalledWith([ diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/handle_api_errors.ts b/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/handle_api_errors.ts index 9089aba147da2a..5e56c4fb0bd221 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/handle_api_errors.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/handle_api_errors.ts @@ -32,7 +32,7 @@ interface IOptions { /** * Converts API/HTTP errors into user-facing Flash Messages */ -export const handleAPIError = ( +export const flashAPIErrors = ( error: HttpResponse, { isQueued }: IOptions = {} ) => {