Skip to content

Commit

Permalink
fix: do not suppress datasource errors
Browse files Browse the repository at this point in the history
  • Loading branch information
simPod committed Mar 13, 2023
1 parent 7b13ec4 commit b27db80
Showing 1 changed file with 6 additions and 43 deletions.
49 changes: 6 additions & 43 deletions src/DataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import {
BackendSrvRequest,
} from '@grafana/runtime';
import { isArray, isObject } from 'lodash';
import { lastValueFrom, of } from 'rxjs';
import { catchError, map } from 'rxjs/operators';
import { lastValueFrom } from 'rxjs';
import { map } from 'rxjs/operators';
import { ResponseParser } from './response_parser';
import {
GenericOptions,
Expand Down Expand Up @@ -76,11 +76,6 @@ export class DataSource extends DataSourceApi<GrafanaQuery, GenericOptions> {
response.data = response.data.map(toDataFrame);

return response;
}),
catchError((err) => {
console.error(err);

return of({ data: [] });
})
)
);
Expand Down Expand Up @@ -147,14 +142,7 @@ export class DataSource extends DataSourceApi<GrafanaQuery, GenericOptions> {
data: variableQueryData,
method: 'POST',
}).pipe(
map((response) => {
return this.responseParser.transformMetricFindResponse(response);
}),
catchError((err) => {
console.error(err);

return of([]);
})
map((response) => this.responseParser.transformMetricFindResponse(response))
)
);
}
Expand All @@ -178,12 +166,7 @@ export class DataSource extends DataSourceApi<GrafanaQuery, GenericOptions> {
isArray(response.data)
? response.data.map((item) => ({ ...item, label: item.label ? item.label : item.value }))
: []
),

catchError((err) => {
console.error(err);
return of([]);
})
)
)
);
}
Expand Down Expand Up @@ -219,12 +202,6 @@ export class DataSource extends DataSourceApi<GrafanaQuery, GenericOptions> {
label: item.label ?? item.value,
};
});
}),

catchError((err) => {
console.error(err);

return of([]);
})
)
);
Expand All @@ -236,14 +213,7 @@ export class DataSource extends DataSourceApi<GrafanaQuery, GenericOptions> {
url: `${this.url}/tag-keys`,
method: 'POST',
data: options,
}).pipe(
map((result) => result.data),
catchError((err) => {
console.error(err);

return of([]);
})
)
}).pipe(map((result) => result.data))
);
}

Expand All @@ -253,14 +223,7 @@ export class DataSource extends DataSourceApi<GrafanaQuery, GenericOptions> {
url: `${this.url}/tag-values`,
method: 'POST',
data: options,
}).pipe(
map((result) => result.data),
catchError((err) => {
console.error(err);

return of([]);
})
)
}).pipe(map((result) => result.data))
);
}

Expand Down

0 comments on commit b27db80

Please sign in to comment.