mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Elasticsearch: Update error message shown when testing the datasource (#70189)
* Elasticsearch: update error message shown when testing the datasource * Elasticsearch: update successful test message * Update e2e test
This commit is contained in:
@@ -75,7 +75,7 @@ export class LegacyQueryRunner {
|
||||
const message = err.data.error?.reason ?? err.data.message ?? 'Unknown error';
|
||||
|
||||
return throwError({
|
||||
message: 'Elasticsearch error: ' + message,
|
||||
message,
|
||||
error: err.data.error,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -505,7 +505,7 @@ describe('ElasticDatasource', () => {
|
||||
|
||||
const errObject = {
|
||||
error: 'Bad Request',
|
||||
message: 'Elasticsearch error: Authentication to data source failed',
|
||||
message: 'Authentication to data source failed',
|
||||
};
|
||||
|
||||
await expect(ds.query(query)).toEmitValuesWith((received) => {
|
||||
|
||||
@@ -426,15 +426,12 @@ export class ElasticDatasource
|
||||
message: 'No date field named ' + this.timeField + ' found',
|
||||
});
|
||||
}
|
||||
return of({ status: 'success', message: `${versionMessage}Index OK. Time field name OK` });
|
||||
return of({ status: 'success', message: `${versionMessage}Data source successfully connected.` });
|
||||
}),
|
||||
catchError((err) => {
|
||||
console.error(err);
|
||||
if (err.message) {
|
||||
return of({ status: 'error', message: err.message });
|
||||
} else {
|
||||
return of({ status: 'error', message: err.status });
|
||||
}
|
||||
const infoInParentheses = err.message ? ` (${err.message})` : '';
|
||||
const message = `Unable to connect with Elasticsearch${infoInParentheses}. Please check the server logs for more details.`;
|
||||
return of({ status: 'error', message });
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user