catch telemtery error (#137986)

This commit is contained in:
Julia Bardi 2022-08-03 16:56:39 +02:00 committed by GitHub
parent cd7578a26e
commit db53455252
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -105,12 +105,15 @@ export class TelemetryEventsSender {
this.isSending = false;
}
private async fetchClusterInfo(): Promise<InfoResponse> {
if (this.esClient === undefined || this.esClient === null) {
throw Error('elasticsearch client is unavailable: cannot retrieve cluster infomation');
private async fetchClusterInfo(): Promise<InfoResponse | undefined> {
try {
if (this.esClient === undefined || this.esClient === null) {
throw Error('elasticsearch client is unavailable: cannot retrieve cluster infomation');
}
return await this.esClient.info();
} catch (e) {
this.logger.debug(`Error fetching cluster information: ${e}`);
}
return await this.esClient.info();
}
public async sendEvents(