mirror of
https://github.com/grafana/grafana.git
synced 2025-02-10 23:55:47 -06:00
Elasticsearch: Fix handling of errors when testing data source (#28498)
#24999 changed the error response payload, but the test data source was not adapted to this change and broke the feature of displaying any errors to the user in the UI. This change should resolve this problem. Ref #24999 Ref #28481
This commit is contained in:
parent
3be82ecd4e
commit
c8b7ccc66c
@ -338,12 +338,8 @@ export class ElasticDatasource extends DataSourceApi<ElasticsearchQuery, Elastic
|
||||
},
|
||||
(err: any) => {
|
||||
console.error(err);
|
||||
if (err.data && err.data.error) {
|
||||
let message = angular.toJson(err.data.error);
|
||||
if (err.data.error.reason) {
|
||||
message = err.data.error.reason;
|
||||
}
|
||||
return { status: 'error', message: message };
|
||||
if (err.message) {
|
||||
return { status: 'error', message: err.message };
|
||||
} else {
|
||||
return { status: 'error', message: err.status };
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user