[Enterprise Search] Fix Error Connecting view not displaying for auth issues (#105125)
* Fix ent-search authentication to show the error connecting screen Missed this in #103555 * [Misc] updoot handleConnectionError order/spacing to match - why? because i've lost control of my life, probably
This commit is contained in:
parent
bcc8ee2532
commit
1739b55f94
|
@ -403,7 +403,7 @@ describe('EnterpriseSearchRequestHandler', () => {
|
|||
expect(responseMock.customError).toHaveBeenCalledWith({
|
||||
statusCode: 502,
|
||||
body: 'Cannot authenticate Enterprise Search user',
|
||||
headers: mockExpectedResponseHeaders,
|
||||
headers: { ...mockExpectedResponseHeaders, [ERROR_CONNECTING_HEADER]: 'true' },
|
||||
});
|
||||
expect(mockLogger.error).toHaveBeenCalled();
|
||||
});
|
||||
|
|
|
@ -283,12 +283,11 @@ export class EnterpriseSearchRequestHandler {
|
|||
|
||||
handleConnectionError(response: KibanaResponseFactory, e: Error) {
|
||||
const errorMessage = `Error connecting to Enterprise Search: ${e?.message || e.toString()}`;
|
||||
const headers = { ...this.headers, [ERROR_CONNECTING_HEADER]: 'true' };
|
||||
|
||||
this.log.error(errorMessage);
|
||||
if (e instanceof Error) this.log.debug(e.stack as string);
|
||||
|
||||
const headers = { ...this.headers, [ERROR_CONNECTING_HEADER]: 'true' };
|
||||
|
||||
return response.customError({ statusCode: 502, headers, body: errorMessage });
|
||||
}
|
||||
|
||||
|
@ -298,9 +297,10 @@ export class EnterpriseSearchRequestHandler {
|
|||
*/
|
||||
handleAuthenticationError(response: KibanaResponseFactory) {
|
||||
const errorMessage = 'Cannot authenticate Enterprise Search user';
|
||||
const headers = { ...this.headers, [ERROR_CONNECTING_HEADER]: 'true' };
|
||||
|
||||
this.log.error(errorMessage);
|
||||
return response.customError({ statusCode: 502, headers: this.headers, body: errorMessage });
|
||||
return response.customError({ statusCode: 502, headers, body: errorMessage });
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue